我是.Net中的aspose.word新手。
我有一个模板文档,我需要用附件替换word文档中的文本字段。我有excel和pdf文档作为附件。
有一天能帮我在word文档中添加附件吗?
谢谢,乔伊
发布于 2016-09-27 15:58:44
将数据绑定到适当的字段后,将其转换为PDF。然后,您可以将这两个PDF合并在一起。
using (var ms = new MemoryStream())
{
// save Aspose doc to stream as pdf
doc.Save(ms, SaveFormat.Pdf);
ms.Position = 0;
// append doc
var pdf = new PdfDocument(ms);
pdf.Append(doc);
pdf.Save(fileName);
}
发布于 2016-10-04 23:34:10
我建议您使用Aspose.Words的find and replace功能找到一个文本,并将其替换为图像和OLE对象。可以使用DocumentBuilder.InsertImage将图像插入到文档中,使用DocumentBuilder.InsertOleObject方法将文件中嵌入或链接的OLE对象插入到文档中。请参考下面的文章。
Use DocumentBuilder to Insert Document Elements
我与Aspose一起工作,作为开发人员的布道者。
发布于 2017-11-15 18:59:26
您可以使用InsertOleObject
试试这个:
doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
Stream memStream = File.OpenRead("addreess+file.xls");
Shape oleObject = builder.InsertOleObject(memStream, "AcroExch.Document.7"", false, null);
https://stackoverflow.com/questions/39695233
复制相似问题