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.

Mon Nov 17, 2025 2:51 pm

Dear support team!

I'm currently facing a problem when it comes to replace a text within a document that also contains a TOC (table of content) if the replacement text matches a chapter number.

I attach the following sample document "test.docx".

And here is the really simple test code:
Code: Select all
Document document = new Document("test.docx");
document.setReplaceFirst(true);
document.replace("XXX", "1", true, true);
document.saveToFile("test.pdf", FileFormat.PDF);


As you can see the task is to replace "XXX" by some different text. The replacement doesn't take place if the replacement text is either "1", "2" or "3". However, the replacement works for any other text. Futhermore it works for "1", "2" and "3" if
setReplaceFirst(true)
is not called before or if the document does not contain a TOC.

I've tested it with the latest version of "Spire.Doc for Java".

Please provide me with a bugfix. Thank you.

Kind regards,
Marcus
Last edited by mgattinger on Fri Dec 12, 2025 2:19 pm, edited 3 times in total.

mgattinger
 
Posts: 65
Joined: Fri May 21, 2021 9:03 am

Tue Nov 18, 2025 3:00 am

Hello,

Thank you for your post.
I have reproduced the issue. The "replace("XXX", "1", true, true)" replacement effect is incorrect when setting "document.setReplaceFirst (true)". I logged this issue into our tracking system with SPIREDOC-11677, our Dev team colleagues will further investigate and optimize it. Once it is resolved, we will provide you with the hotfix version as soon as possible. We apologize for any inconvenience caused.

Sincerely,
Lisa
E-iceblue support team
User avatar

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

Thu Dec 11, 2025 3:21 am

Hello,

Thank you for your patience. Glad to inform you that our latest version Spire.Doc for Java Version:13.12.2 includes fixes for SPIREDOC-11677 issue, please update and test it.

Sincerely,
Lisa
E-iceblue support team
User avatar

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

Thu Dec 11, 2025 3:23 pm

Hi Lisa!

Thank you for the update.

Unfortunately I have problems downloading this release from your Maven repository. Here is what I get:

[WARNING] Checksum failed: spire.doc-13.12.2.pom [https://repo.e-iceblue.com/nexus/content/groups/public/]
[WARNING] The POM for e-iceblue:spire.doc:jar:13.12.2 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details

Can you double-check your repository that this release is correctly uploaded, please?

Kind regards,
Marcus

mgattinger
 
Posts: 65
Joined: Fri May 21, 2021 9:03 am

Fri Dec 12, 2025 1:58 am

Hello,

Sorry for the inconvenience caused. We have adjusted the Maven repository configuration, it can be successfully downloaded now. Please clear your local Maven cache first, and then reinstall it to test.
If you have any other questions, just feel free to contact.

Sincerely,
Lisa
E-iceblue support team
User avatar

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

Fri Dec 12, 2025 2:16 pm

Hello Lisa, I was now able to download the library from your repository.

There are still some warnings, though:
[WARNING] Checksum failed: spire.doc-13.12.2.pom [https://repo.e-iceblue.com/nexus/content/groups/public/]
[WARNING] Checksum failed: spire.doc-13.12.2.jar [https://repo.e-iceblue.com/nexus/content/groups/public/]

I would advice to fix the reason for these warnings, too.

However these warnings do not prevent my test code from being executed and I can confirm that this version resolves the issue of this topic.
Thank you for the quick bug fix.

Kind regards,
Marcus

mgattinger
 
Posts: 65
Joined: Fri May 21, 2021 9:03 am

Mon Dec 15, 2025 2:58 am

Hello,

Thank you for your feedback. Regarding the warning, would you like to confirm if you installed and used it directly in the Maven project? I did not encounter such a warning during testing.
5.png

In addition, this path is actually for the sake of compatibility with our previous customers' use, and it involves forwarding. If you want to directly obtain jar or pom files by browsing the url, you can use the following path.
https://repo.e-iceblue.com/repository/m ... 3.12.2.jar
https://repo.e-iceblue.com/repository/m ... 3.12.2.pom

Sincerely,
Lisa
E-iceblue support team
User avatar

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

Mon Dec 15, 2025 10:24 am

Hi Lisa!

I have double-checked my pom.xml and I can confirm that the repository element looks correctly:

<repository>
<id>com.e-iceblue</id>
<name>e-iceblue</name>
<url>https://repo.e-iceblue.com/nexus/content/groups/public/</url>
</repository>

However, I figured out, that e-iceblue publishes its artifacts without sha1-files. I checked other artifacts within my local Maven repository and all others I checked contain the following files:

[name].jar
[name].jar.sha1
[name].pom
[name].pom.sha1

If I download the artifacts for Spire.Doc for Java I get the following warnings:
Downloading from com.e-iceblue: https://repo.e-iceblue.com/nexus/conten ... 3.12.2.pom
[WARNING] Could not validate integrity of download from https://repo.e-iceblue.com/nexus/conten ... 3.12.2.pom
Downloading from com.e-iceblue: https://repo.e-iceblue.com/nexus/conten ... 3.12.2.jar
[WARNING] Could not validate integrity of download from https://repo.e-iceblue.com/nexus/conten ... 3.12.2.jar

And this is the exception that causes these warnings:
org.eclipse.aether.transfer.ChecksumFailureException: Checksum validation failed, no checksums available

So it's pretty clear, why I receive this warning. To get rid of it you have to publish the sha1-files, too.

Furthermore I checked your repository and found out that you published the checksum files up to version 13.4.1. Starting from version 13.5.3 no checksum files are published any longer. Any reason why you stopped publishing them? I consider this as a security issue.

Kind regards,
Marcus

mgattinger
 
Posts: 65
Joined: Fri May 21, 2021 9:03 am

Tue Dec 16, 2025 5:37 am

Hello

Thank you for your feedback. Regarding Spire.Doc for Java Version:13.12.2, we have made adjustments and added the .sha files. Please test again. If there are no issues, we will update future versions in this way.

Sincerely,
Lisa
E-iceblue support team
User avatar

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

Thu Dec 18, 2025 10:47 am

Thank you for updating your repository. I can confirm that the warning is not shown any longer.

mgattinger
 
Posts: 65
Joined: Fri May 21, 2021 9:03 am

Fri Dec 19, 2025 1:26 am

Hello,

Glad to hear that, the future versions will be updated in this way.
If there is anything else we can do for you in the future, just feel free to contact.

Sincerely,
Lisa
E-iceblue support team
User avatar

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

Return to Spire.Doc