Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Wed Aug 05, 2020 2:21 pm

Is there a way to keep comments on a word document during conversion?

For example, I have a comment on my document so I convert it to html and then go back to docx / doc, is it possible to bring my comments?

prado_lol
 
Posts: 10
Joined: Thu Jul 30, 2020 7:12 pm

Thu Aug 06, 2020 8:15 am

Hi

Thanks for your post.
Our Spire.Doc allows parsing and writing comment of document when converting to html.Please refer to the code below. If there is still any question, please provide your Word document for our reference.
Code: Select all
Document document = new Document();
document.LoadFromFile("test.docx");
//Add this line
document.HTMLCustomComment = true;
document.SaveToFile("toHTML.html", FileFormat.Html);
document.LoadFromFile("toHTML.html", FileFormat.Html, XHTMLValidationType.None);
document.SaveToFile("test.docx", FileFormat.Docx);


Sincerely,
Lynn
E-iceblue support team
User avatar

lynn.zhang
 
Posts: 57
Joined: Mon Jul 27, 2020 2:27 am

Thu Aug 06, 2020 3:11 pm

Worked, thank you.

What about the header and footer?
I realized that it brings the content (header / footer) out of the header and footer area of ​​the word, as shown in the image below:

before:
Image

after:
Image


it is possible to bring it to the correct place as a header / footer, as if it were in the original document?

Thank advance

prado_lol
 
Posts: 10
Joined: Thu Jul 30, 2020 7:12 pm

Fri Aug 07, 2020 7:24 am

Hi

Thanks for your inquiry.
I indeed notice the behavior you mentioned. After investigation, I found the issue was caused by that the header and footer themselves cannot be written in HTML. Kindly note that the internal principle of Word is different from that of HTML, and many of the tags or css styles in the html have no corresponding settings in the Word. To verify it, you could save your word to html using Microsoft Word, then open the html in browser, you will see that no header/footer data exists in html. Our Spire.Doc keeps the complete data of word and writes the header/footer in body content, hence the content was out of the header and footer area after converting to word. Sorry our Spire.Doc can't bring it back to header/footer area at present. Hope you can understand.

Sincerely,
Lynn
E-iceblue support team
User avatar

lynn.zhang
 
Posts: 57
Joined: Mon Jul 27, 2020 2:27 am

Fri Aug 07, 2020 4:50 pm

I understand, the same goes for the numbering that is converted to text , as shown below?

before:
Image

after:
Image

Another question, in some cases the numbering restarts, why does this happen?
the document that occurs this is attached, this occurs after the following conversion flow: docx -> html -> docx.

prado_lol
 
Posts: 10
Joined: Thu Jul 30, 2020 7:12 pm

Mon Aug 10, 2020 9:06 am

Hi

Thanks for your post.
I tested your case and indeed found the problem that the numbering was converted to text. I have logged this problem into our bug tracking system with ticket number SPIREDOC-4869. Once it is fixed or there is any update, I will inform you immediately. I'm sorry for the inconvenience.
In addition, as for the issue that the numbering restarts , I did not find this problem after testing. Please provide your test file for further investigation. Thanks in avdance. You could attach your file here or send it to us via email (support@e-iceblue.com).

Sincerely,
Lynn
E-iceblue support team
User avatar

lynn.zhang
 
Posts: 57
Joined: Mon Jul 27, 2020 2:27 am

Mon Aug 10, 2020 11:47 am

Thanks for the answer.

attached my document to test the restart numbers.

before:
Image

after:
Image

prado_lol
 
Posts: 10
Joined: Thu Jul 30, 2020 7:12 pm

Tue Aug 11, 2020 3:58 am

Hi

Thanks for your post.
I tested your case and indeed found the problem that the numbering was reordered after conversion. I have logged this problem into our bug tracking system with ticket number SPIREDOC-4873. Once it is fixed or there is any update, I will inform you immediately. I'm sorry for the inconvenience.

Sincerely,
Lynn
E-iceblue support team
User avatar

lynn.zhang
 
Posts: 57
Joined: Mon Jul 27, 2020 2:27 am

Wed Aug 12, 2020 12:35 pm

Thanks for the replies, I look forward to a return on SPIREDOC-4869 and SPIREDOC-4873

prado_lol
 
Posts: 10
Joined: Thu Jul 30, 2020 7:12 pm

Thu Aug 13, 2020 3:24 am

Hi

Thanks for your reply.
I will keep you informed once there is any meaningful progress. Wish you a nice day!

Sincerely,
Lynn
E-iceblue support team
User avatar

lynn.zhang
 
Posts: 57
Joined: Mon Jul 27, 2020 2:27 am

Tue Sep 22, 2020 3:20 am

lynn.zhang wrote:Hi

Thanks for your post.
Our Spire.Doc allows parsing and writing comment of document when converting to html.Please refer to the code below. If there is still any question, please provide your Word document for our reference.
Code: Select all
Document document = new Document();
document.LoadFromFile("test.docx");
//Add this line
document.HTMLCustomComment = true;
document.SaveToFile("toHTML.html", FileFormat.Html);
document.LoadFromFile("toHTML.html", FileFormat.Html, XHTMLValidationType.None);
document.SaveToFile("test.docx", FileFormat.Docx);


Sincerely,
Lynn
E-iceblue support team


Dear Lynn,
When I added this line:
document.HTMLCustomComment = true;
document.SaveToFile("toHTML.html", FileFormat.Html);
--> I can't find my comment in "toHTML.html". Could you please show me where my comment is?

supermun
 
Posts: 24
Joined: Fri May 15, 2020 6:51 am

Tue Sep 22, 2020 3:46 am

I mean How can I display my comment in exported HTML file?

supermun
 
Posts: 24
Joined: Fri May 15, 2020 6:51 am

Tue Sep 22, 2020 11:07 am

Hi supermun,

Thanks for your inquiry.
In fact, the html file generated by our Spire.Doc contains comments, the comments are converted into span tags (see the screenshot below).
spire.png


Please note that the specifications and structure of Word files and HTML files are completely different, and HTML specification does not support displaying comments like in Word files.
Our Sprire.Doc is based on Microsoft Word, and using Microsoft Word to convert a Word file with comments to html, the result is as follows:
MS Word.png

If you want the HTML file generated by our Spire.Doc to display comments as above, we can consider adjusting this function to achieve a similar effect to Microsoft Word.


Sincerely,
Elena
E-iceblue support team
User avatar

Elena.Zhang
 
Posts: 279
Joined: Thu Jul 23, 2020 1:18 am

Wed Sep 23, 2020 8:12 am

Dear Elena,

Could you please guild me display comments as your picture?

Thank you very much!

supermun
 
Posts: 24
Joined: Fri May 15, 2020 6:51 am

Wed Sep 23, 2020 10:52 am

Hi supermun,

Thank you for your prompt reply.
Sorry that my reply may have caused you some misunderstanding. Currently, the html file generated by our Spire.Doc contains comments, but they are not displayed directly in the browser, we do not yet support displaying comments like the html generated by Microsoft Word. I have posted this issue to the Dev team with the ticket SPIREDOC-4997 to adjust the function of converting Word to HTML. If there is any progress, we will let you know. Sorry for the inconvenience caused.

Sincerely,
Elena
E-iceblue support team
User avatar

Elena.Zhang
 
Posts: 279
Joined: Thu Jul 23, 2020 1:18 am

Return to Spire.Doc

cron