Search code examples
lotus-noteslotus-dominolotusscriptlotus-formula

Change background color of richtexttablecell


I like to change the backgroundcolor of a richtexttablecell, I try to solve the problem with lotusscript, but there isn't an method or attribute for this in lotus script. looks like it is possible to solve this with c api.

can anyone help me?


Solution

  • Use the NotesDXLExporter and NotesDXLImporter:

    • export the document as DXL,
    • replace table properties in DXL and
    • import it back to document.

    Make sure that you use notesDXLExporter.RichTextOption=0.

    This is an example for a table with background colors in DXL format:

    <item name='Body'>
        <richtext>
            <pardef id='1' />
            <par def='1' />
            <table widthtype='fixedleft' refwidth='2.1493in'>
                <tablecolumn width='1.0667in' />
                <tablecolumn width='1.0826in' />
                <tablerow>
                    <tablecell bgcolor='blue'>
                        <pardef id='3' keepwithnext='true' keeptogether='true' />
                        <par def='3' />
                    </tablecell>
                    <tablecell bgcolor='red'>
                        <pardef id='4' keepwithnext='true' keeptogether='true' />
                        <par def='4' />
                    </tablecell>
                </tablerow>
                <tablerow>
                    <tablecell bgcolor='yellow'>
                        <par def='3' />
                    </tablecell>
                    <tablecell>
                        <par def='4' />
                    </tablecell>
                </tablerow>
            </table>
            <par def='1' />
        </richtext>
    </item>
    

    It should be easy to replace the bgcolor properties in DXL.

    You can find a code snippet for DXL-export here.