Closed ylussaud closed 1 year ago
We could reopen this issue :
HTML_RichText_Converter.py.txt HTMLDescription_To_Excel_Description.py.txt Hi Sophie,
Following this message on the forum https://forum.mbse-capella.org/t/interpreting-capella-descriptions-in-excel/5629/5 I started to write a script that transforms the HTML description into formatted text.
This script uses the standard xlsxwriter library (rather than the openpyxl we use in other example scripts) simply because it is impossible to do it with the openpyxl library. There is no additional component to install as this library is already in the package we deliver.
This script has been tested relatively well (on different "real" models) and works well. There are significant limitations for the simple reason that Excel has some major limitations in what you can do within a cell (to make it simple, Excel cannot render HTML within a cell, so there are no images, no "true" links, no tables...). Still, the result is generally pretty convincing when the formatting in the Description is not too complex.
This script handles most of what you can do with Capella's current HTML Description editor (font, color, sizes, etc...). I have the 2 final improvements to make: (1) better handling of table/td/tr tags (2) better handling of ul/ol/li tags when used in cascade; but what is there is already providing a pretty nice result
Would you be ok with this being contributed to the script examples?
Stephane
Updated version of the script with:
Convert the description from HTML to text when inserting in the generated Python code. For the moment the HTML tags and entities are inserted which is not easy to read.