如何使用docx dll保存图像

编程入门 行业动态 更新时间:2024-10-09 08:33:41
本文介绍了如何使用docx dll保存图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我必须使用docx dll创建一个文档,在顶部我需要向文档添加四个文本值。在这里我可以将这些文本添加到docx中,然后使用doc.Save()进行保存;方法。 之后,我需要将一些图像添加到同一文档中,我可以根据我的要求添加这些图像。之后我使用doc.SaveAs(Path);保存最终文档的方法。但在执行另存为方法时,上面添加的文本会自动删除。即在最终文件中,我的图像不是文字。 C#:使用DocX以编程方式创建和处理Word文档 [ ^ ] 提前致谢

I have to create a document using docx dll, in the top section i need to add four text values to the document. here i can add those text to the docx and i save using doc.Save(); method. after that i need to add some images to same document and i can add those images based on my requirement. after that am using doc.SaveAs("Path"); method to save the final document.but while doing the save as method the above added text is removing automatically. ie in the final document i have onlt the image not the text. C#: Create and Manipulate Word Documents Programmatically Using DocX[^] Thanks in advance

推荐答案

为什么不问你引用文章的作者?找到评论和讨论部分,点击添加评论或问题并提出您的问题。作者将收到通知并进行更改以回答您的问题。只需点击以下链接: www.codeproject/script/Forums/Edit.aspx?fid=1843475&floc=/Articles/660478/Csharp-Create-and-Manipulate -Word-Documents-Progra [ ^ ]。
-SA
Why not asking the author of the article you referenced? Locate "Comments and Discussion" section at the end, click "Add a Comment or Question" and ask your question. The author will receive a notification and get a change to answer you. Just click in the link below: www.codeproject/script/Forums/Edit.aspx?fid=1843475&floc=/Articles/660478/Csharp-Create-and-Manipulate-Word-Documents-Progra[^].
—SA

您可能覆盖了同一个文件。修改时,加载文件并进行修改并保存。例如: you may have overwrite the same file. when you modify, load the file and do the modification and save it. for example : //create new document and add some text using (DocX doc= DocX.Create(filename)) { doc.InsertParagraph("This is my first paragraph"); // save the document in given path doc.SaveAs(path) } // load from your path using (DocX document = DocX.Load(path)) { //and modify it document.InsertParagraph("This is my second paragraph"); document.Save(); }

更多推荐

如何使用docx dll保存图像

本文发布于:2023-11-13 03:09:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1583255.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何使用   图像   docx   dll

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!