使用OpenXML SDK添加自动文本

时间:2014-01-30 14:38:51

标签: c# openxml openxml-sdk

如何在sql数据库中保存自动文本对象,并将其用openxml sdk 2.5与c#一起写回一个单词模板。

这是我试图为图像做的事情:

foreach (DocumentBinaryPart relatedDocumentPart in AutotextContainer.RelatedDocumentParts.Where(x => x.Type == "ImagePart"))
{
    ImagePart imagePart = mainDocumentPart.GlossaryDocumentPart.AddImagePart(relatedDocumentPart.ImageType, relatedDocumentPart.relationshipid);

    using (Stream stream = new MemoryStream(relatedDocumentPart.Data))
        imagePart.FeedData(stream);

    mainDocumentPart.GlossaryDocumentPart.AddPart<ImagePart>(imagePart, relatedDocumentPart.relationshipid);
}

我尝试在此相关文档部分中保存自动文本以将其保存在数据库中...

0 个答案:

没有答案