background color in rtf output
Hi,
I use the --page-color
flag to set the background color of the generated .rtf file.
However, on MacOS some editors do not show the background color set in the rtf. This happens for example in the Quick Look preview and in the TextEdit application.
Checking the code generated by TextEdit and Microsoft Word, I suggest this change to rtfgenerator.cpp:210
:
-- *out<<"\\viewbksp1\\ilfomacatclnup0{\\*\\background{\\shp{{\\sp{\\sn fillColor}{\\sv "<<svVal<<"}}}}}\n";
++ *out<<"\\viewbksp1\\ilfomacatclnup0{\\*\\background{\\shp{{\\*\\shpinst\\shpleft0\\shptop0\\shpright0\\shpbottom0\\shpfhdr0\\shpbxmargin\\shpbymargin\\shpwr0\\shpwrk0\\shpfblwtxt1\\shpz0{\\sp{\\sn shapeType}{\\sv 1}}{\\sp{\\sn fillColor}{\\sv "<<svVal<<"}}{\\sp{\\sn fFilled}{\\sv 1}}{\\sp{\\sn lineWidth}{\\sv 0}}{\\sp{\\sn fLine}{\\sv 0}}{\\sp{\\sn bWMode}{\\sv 9}}{\\sp{\\sn fBackground}{\\sv 1}}}}}}\n";
The generated rtf works well on Microsoft Word, Libre Office and Apple TextEdit.
Note: The tag needed to show the background appears to be \shplidN
, where N is a unique number that identifies each shape. 1025 is an arbitrary value.
Thanks