Hello Team,
We are using ASPOSE WORDS library v24.1 and we are inserting the attached HTML into the Document using the HtmlLoadOptions instance. The HTML contains cell with font color as “transparent” but upon inserting into the WORD Document, it renders in “black” color as if the transparent value is ignored by the library.
We tried the same use-case using a MS Word Blank Document and inserted the HTML using “Insert → Object → Text From File” option and it does the same behavior showing text in black color as opposed to Transparent color.
Transparent Cell.zip (12.1 KB)
Let us know if there is a way to set the cell font color to “Transparent”.
@oraspose Color of text in MS Word (DOCX) document is specified using val
attribute in color
evlement. And here is what specification says:
val (Run Content Color) - Specifies the color for this run. This color can either be presented as a hex value (in RRGGBB format), or auto to allow a consumer to automatically determine the run color as appropriate.
If the run specifies the use of a theme color via the themeColor attribute, then this value is superseded by the theme color value.
[Example: Consider a run color with value auto, as follows:
<w:rPr>
<w:color … w:val="auto" />
</w:rPr>
This color therefore can be automatically be modified by a consumer as appropriate, for example, in order to ensure that the run contents can be distinguished against the page’s background color. end example]
As you can see color value does not have Alpha channel. So it is not possible to set transparent text color in MS Word document.
So in your case Auto color is used and to make content visible MS Word turns text to black.
It is not possible for ASPOSE WORDS library to set the text color to transparent. Is this statement correct?
@oraspose Yes, it is correct. You cannot set transparent color of text because it is not supported by MS Word document formats.
@alexey.noskov Thank you for the confirmation. By any chance, is there a link to their documentation?
@oraspose Sure you can download DOCX specification as ISO-29500 standard from here:
https://www.iso.org/standard/71691.html
You are interested in ISO_IEC_29500-1_2016
document. See 17.3.2.6 color (Run Content Color)
chapter.
Really appreciate your help. Thank you.
1 Like