[英]Addin Link [URL] to an Image in Excel cell using open xml
我试图用AddExternalRelationship
方法,但它不工作,只是我想链接添加到文件[我在这种情况下,文件服务器上的图片]使用openXML
using (var newDoc = SpreadsheetDocument.Open(xlsDestFilePath, true)) {
var run = new DocumentFormat.OpenXml.Spreadsheet.Run();
var picture = new DocumentFormat.OpenXml.Spreadsheet.Picture();
var shape = new DocumentFormat.OpenXml.Vml.Shape() {
Id = "_x0000_i1025",
Style = "width:453.5pt;height:270.8pt"
};
run.Append(picture);
newDoc.AddHyperlinkRelationship(
new Uri("URL GOES HERE", System.UriKind.Absolute), true);
}
使用AddHyperlinkRelationship
msdn 文档中明确说明不使用AddExternalRelationship
参考: https : //msdn.microsoft.com/en-us/library/office/cc562653.aspx
public HyperlinkRelationship AddHyperlinkRelationship(
Uri hyperlinkUri,
bool isExternal,
string id
)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.