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.

Thu May 23, 2019 1:57 am

Hi All,

I'm attempting to replace a bookmarks content using the ReplaceBookmarkContent method and I'm getting a :

System.NotSupportedException : Not supported deleting content between bookmarks in different paragraphs'

I've inspected the bookmark in the word document I'm attempting to edit and cannot see how or why this is happening?

Does anyone have anymore detail around the specifics of this exception?

kaimon
 
Posts: 16
Joined: Fri May 17, 2019 4:04 am

Thu May 23, 2019 2:56 am

Hello,

Thanks for your inquiry.
After an initial test with our latest Spire.Doc Pack(hot fix) Version:7.5.9, I didn't reproduce your issue. Thus, I suggest that you try again with the latest version. If your issue still occurs after trying, to help us further look into it, please provide your input word file as well as your full testing code. You could send them to us via email (support@e-iceblue.com).

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1261
Joined: Wed Apr 25, 2018 3:20 am

Thu May 23, 2019 6:20 am

Does this hotfix work for the free version?

kaimon
 
Posts: 16
Joined: Fri May 17, 2019 4:04 am

Thu May 23, 2019 6:35 am

Hello,

Thanks for your feedback.
Please kindly note that the Hotfix version is our paid version, it will generate the evaluation message without applying a valid license. However, we are willing to provide a temporary license(one month free) of Spire.Doc to help you remove the warning message and evaluate our commercial version better. If interested, please contact our sales team (sales@e-iceblue.com) to get it. Besides, how is your issue going after trying with the paid version? Has the version resolved your issue? If not, please share us with your input file as well as your full testing code.

Sincerely,
Lisa
E-icbelue support team
User avatar

Lisa.Li
 
Posts: 1261
Joined: Wed Apr 25, 2018 3:20 am

Thu May 23, 2019 11:22 am

I've updated to the latest commercial version with the hotfix you mentioned and am still seeing the same issue.

Something that I am doing (which could be a problem) is using MSWORD to edit/save the doc file generated by spire.

Does MSWORD change the format of the DOC xml that cause this error to occur? When I compare the contents.xml, it looks like it has changed.

kaimon
 
Posts: 16
Joined: Fri May 17, 2019 4:04 am

Thu May 23, 2019 12:11 pm

It also seems to be only occuring for Tables.

kaimon
 
Posts: 16
Joined: Fri May 17, 2019 4:04 am

Fri May 24, 2019 7:00 am

Dear kai,

Thanks for your feedback.
I added a table and inserted a bookmark for it in MS Word. Then loaded the template by our Spire.Doc and executed the ReplaceBookmarkContent method, I reproduced the issue "System.NotSupportedException" you described. After analyzing the structure of the document, I found actually the bookmark start and end are included in the table object, that indicates the contents of the bookmark are table cells, which are not a complete object. The ReplaceBookmarkContent method requires complete object. That's the reason why we get the exception. To avoid the issue, please move the bookmark start and end out of the table object, so that the bookmark contains the complete table object. Please see the screenshots and my documents in the attachment. If there is any question or misunderstanding. Please share your sample word file for a better reference.

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1187
Joined: Tue Sep 27, 2016 1:06 am

Tue May 28, 2019 1:37 am

Thanks Nina.

Yes, this is what I found when I looked at the XML as well. However, the problem is I did not manually change the bookmark locations at any time.

My steps were:

1) generate word doc from SPIRE.
2) open up document in WORD 2016.
3) save doc in WORD 2016.
4) attempt to update bookmark contents using spire.

It seems as if WORD2016 is doing this modification and I cannot work out how to stop it.

kaimon
 
Posts: 16
Joined: Fri May 17, 2019 4:04 am

Tue May 28, 2019 3:48 am

Hi,

Thanks for your feedback.
Did you mean that the bookmark was added to table automatically after you re-saved your generated Word in MS Word 2016? To help us better understand your issue and help you out, please provide the following information. Thanks in advance.
1) The code you used to generate Word file using our Spire.Doc.
2) Your Word file generated from Spire.Doc.
3) Your Word file saved by MS Word 2016.

You could send them to us via email (support@e-iceblue.com). We promise to keep your documents confidential and we will never publish them or use them for any other purpose.

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1187
Joined: Tue Sep 27, 2016 1:06 am

Wed Jun 05, 2019 3:56 am

This is a snippet of the XML saved from SPIRE. Notice that the bookmark surrounds the <w:tbl> element.

2019-05-30 16_02_34-C__Working_OfficeAddin2_BloombergRecommendations_BloombergRecommendations.Web_Re.png



And below is a snippet of the XML after word 2016 does its thing. Notice that the bookmark end tag is now within the <w:tbl> element. Hence SPIRE throws an exception at this point complaining about the bookmark being within another element.

2019-05-30 16_01_13-C__Working_OfficeAddin2_BloombergRecommendations_BloombergRecommendations.Web_Re.png


Not sure what to do about this? I can't see how to stop WORD from modifying the word document so that its acceptable by SPIRE. The only other option is for SPIRE to handle these cases?

kaimon
 
Posts: 16
Joined: Fri May 17, 2019 4:04 am

Wed Jun 05, 2019 9:04 am

Hello,

Thanks for your feedback.
You used our Spire.Doc to operate Word document and got the result that the bookmark surrounds the <w:tbl> element. But, after you open the Word generated by our Spire.Doc and re-save it in MS Word 2016, the bookmark end tag changed automatically, it moved into the <w:tbl> element. Is this the process of recreating your problem? I did a test with MS Word 2016, but didn't encounter your issue. Please provide the following information, so that we could investigate your issue accurately and help you out. We promise to keep your documents confidential and won't use them for other purpose. Or you can remove the security data from your Word and send them to us via email (support@e--iceblue.com), just make sure the Word could reproduce your issue. Thanks in advance.

1) Your Word file generated by our Spire.Doc.
2) Your Word file saved by MS Word 2016.
3) The specific version of your MS Word 2016. Please provide a screenshot like the attachment.

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1187
Joined: Tue Sep 27, 2016 1:06 am

Tue Jun 11, 2019 2:52 am

Hi,

Thank you for sharing your files via email.
I have noticed that after saving the FromSpire.docx by Microsoft Word 2016, the BookmarkEnd tag moved into the <w:tbl> element. I have submitted the behavior to our Dev team for further investigation, if there is any update, I will inform you. Apologize for the inconvenience caused.

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1187
Joined: Tue Sep 27, 2016 1:06 am

Tue Jun 18, 2019 11:48 pm

HI is there any update?

kaimon
 
Posts: 16
Joined: Fri May 17, 2019 4:04 am

Wed Jun 19, 2019 2:44 am

Hi,

Sorry there is no update yet. Our development team haven't found a breakthrough since your issue is complex. Please spare us more time. I will keep you informed if there is any good news. Thanks for your understanding.

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1187
Joined: Tue Sep 27, 2016 1:06 am

Fri Jul 26, 2019 8:33 am

Hi,

Did you test the hotfix Spire.Doc Pack(hot fix) Version:7.6.16 that I provided via email? Please note that currently the latest Spire.Doc on our website is Spire.Doc Pack Version:7.7 which also contains the fixes of your issue. Could you please give us some feedback about your issue at your convenience?

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1187
Joined: Tue Sep 27, 2016 1:06 am

Return to Spire.Doc