Thanks for your inquiry. As suggested earlier, you could still use the following code for creating an instance of your Word document to be able to modify it as you need:
// Open the stream. Read only access is enough for Aspose.Words to load a document.
Stream stream = File.OpenRead(@"C:\test\demofile.docx");
// Load the entire document into memory.
Document docCopy = new Document(stream);
// You can close the stream now, it is no longer needed because the document is in memory.
Once you are done with performing different document processing tasks e.g. editing the text on docCopy, just save it to a new Word document file as follows:
I hope, this will help.
Thanks once again for the help.I thought the same but the things is when i am editing docCopy, will it preserve format.
For e.g. I want to modify first paragraph.
So i’ll get run.Text for first paragraph from docCopy and upon editing the text i’ll simply say run.Text=Modified Text . Is that what you meant? Will it replace the original data in docCopy? Will it work?
Also will it work in case of list, Table data? I meant will it preserve bullet information and all if i edit using run.Text.
Thanks for your inquiry.
Yes, you could modify the text that way while preserving the formatting. Also, please note that all text of the document is stored in runs of text; as suggested earlier, please see the following link for more details:
Moreover, for the purpose of addressing your future queries, I would suggest you to please create separate logical threads so that we can keep related posts under specific headings.
Thanks for the reply. I’ll sure look into it.
Regarding creating some logical thread, i couldn’t find a way to change the title of this thread. As i am new to this forum, i don’t know whether i can create separate thread and just add to you. So shall i create some other thread naming “Queries related to Aspose.Word API in .Net” and add you or if possible can you please create a thread where you feel comfortable and add me over there.
Thanks for your request. You are not required to change the title of current thread i.e. titled Extract Doc data (statement by statement); however, if in the future you may have questions regarding some other topic, you should create a new thread (Post) for that just like you started this conversation.
Thanks for the reply. I will create new thread now onwards for each of the new question i have.