如何将共享图片库中的图像插入到Excel中 [英] How to insert image from share point picture library into excel

查看:99
本文介绍了如何将共享图片库中的图像插入到Excel中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我特此附上我的代码.请帮助我解决我的问题.预先感谢.

I hereby attached my code. Please help me solve my problem. Thanks in advance.

HtmlImage图片=新的HtmlImage();
image.Src ="SPContext.Current.Web.Url +/Dashboard_Images/myImage.jpg";
image.Height = 400;
image.Width = 800;
image.Border = 5;

HtmlImage image = new HtmlImage();
image.Src = "SPContext.Current.Web.Url + /Dashboard_Images/myImage.jpg";
image.Height = 400;
image.Width = 800;
image.Border = 5;

使用(StringWriter sw = new StringWriter())
                {
                   使用(HtmlTextWriter hw =新的HtmlTextWriter(sw))
                    {
                       文字ltrTitle = new Literal();
                        ltrTitle.Text = ltrMemberName.Text;

                        System.Web.UI.WebControls.Table tbl =新的System.Web.UI.WebControls.Table();
                        TableRow trTitle =新的TableRow();
                        trTitle.Cells.Add(new TableCell());
                        trTitle.Cells [0] .Controls.Add(image);

using (StringWriter sw = new StringWriter())
                {
                    using (HtmlTextWriter hw = new HtmlTextWriter(sw))
                    {
                        Literal ltrTitle = new Literal();
                        ltrTitle.Text = ltrMemberName.Text;

                        System.Web.UI.WebControls.Table tbl = new System.Web.UI.WebControls.Table();
                        TableRow trTitle = new TableRow();
                        trTitle.Cells.Add(new TableCell());
                        trTitle.Cells[0].Controls.Add(image);

                      }

                      }

            }

            }

注意:Excel中的图像在除我的服务器以外的任何其他系统中均不可见.

Note: Image in Excel is not visible in any other systems except my server.


推荐答案

请修改代码

image.Src = "SPContext.Current.Web.Url + /Dashboard_Images/myImage.jpg";

image.Src = SPContext.Current.Web.Url + "/Dashboard_Images/myImage.jpg";

或者尝试使用Open XML SDK将图像插入Excel.

Or try to insert image into Excel using Open XML SDK.

> https://code.msdn.microsoft.com/office/How -to-insert-image-into-93964561

最好的问候,

丹尼斯


这篇关于如何将共享图片库中的图像插入到Excel中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆