I am working on creating tables in word document using ASPOSE WORD JAVA API.
I faced a problem while setting column width for table in word using ASPOSE API.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
In my scenario I have to set column width according to the header text. So I need some way to get the column width by characters in the text.
Currently , I used to get the character count and to get the width multiply it with some constant (assuming the point width of single character).
e.g. total number of character in text is ‘charCount’ then my column width will be
‘charCount * 5.8’.
If I reduce my constants value from 5.8 to some smaller value the text starts wrapped or
If I tried to increase this constant the column width got increased more significantly.
to set the column width I used following API
builder.getCellFormat().setWidth(value);
for small text this technique is working fine but when text exceeds more then 40-50 character the extra space got added.
This space keep increasing propositionally bigger with increase in characters. Please find the document attached for the problem.
Is there any way to set the width of cell to best fit the text?