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.

Sun May 07, 2023 5:42 pm

Hi,
Please help with setting color on content control (please see attached image).
We using SpireDoc java library 11.3.0
Thanks,
Andrey

andrei.chorin
 
Posts: 68
Joined: Sun Jan 08, 2023 2:36 pm

Mon May 08, 2023 2:46 am

Hi,

Thank you for reaching out to us regarding how to set the color of content controls in our Spire.Doc. Currently, it does not support this feature.
However, we have added it as a new feature to our update-list with the ticket number SPIREDOC-9393. Once this feature is implemented, we will notify you immediately.
Thank you for your understanding. Please let us know if you have any further questions or concerns.

Best regards,
Triste
E-iceblue support team
User avatar

Triste.Dai
 
Posts: 1000
Joined: Tue Nov 15, 2022 3:59 am

Fri Jun 09, 2023 7:53 am

Hi,

Thanks for your patience.
Glad to inform you that we just released Spire.Doc for Java 11.6.0, which has implemented the new feature SPIREDOC-9393: Set the color of content controls. See the following code for reference.
Code: Select all
for (Object docObj : doc.getSections().get(0).getBody().getChildObjects()) {
    if (docObj instanceof StructureDocumentTag) {
        DocumentObject Obj = (DocumentObject) docObj;
        SDTProperties sdtProperties = ((StructureDocumentTag) Obj).getSDTProperties();
        switch (sdtProperties.getSDTType()) {
            case Rich_Text:
                sdtProperties.setColor(Color.ORANGE);
                break;
            case Text:
                sdtProperties.setColor(Color.green);
                break;
        }
     }
  }

Please download from the following links and have a test.

Website: https://www.e-iceblue.com/Download/doc-for-java.html

Maven:
Code: Select all
<repositories>
    <repository>
        <id>com.e-iceblue</id>
        <name>e-iceblue</name>
        <url>https://repo.e-iceblue.com/nexus/content/groups/public/</url>
    </repository>
</repositories>
<dependencies>
    <dependency>
        <groupId>e-iceblue</groupId>
        <artifactId>spire.doc</artifactId>
        <version>11.6.0</version>
    </dependency>
</dependencies>


Best regards,
Triste
E-iceblue support team
User avatar

Triste.Dai
 
Posts: 1000
Joined: Tue Nov 15, 2022 3:59 am

Return to Spire.Doc

cron