We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Formatting a table

Hello,

i have a question concerning formatting Tables:



i attached a file with a screenshot from my table - for any reason the format of the different row changes inbetween - and the alignment too. what is the best way to get an correctly formatted table ?

my intention is to create bold entries in the first both rows and regular text in the third one.



i’m using this kind of code:



builder.startTable();

builder.getRowFormat().setBottomPadding(0);

builder.insertCell();

builder.getCellFormat().clearFormatting();

builder.getRowFormat().clearCellPadding();

builder.getCellFormat().setBottomPadding(0);

builder.getCellFormat().setTopPadding(0);

builder.getCellFormat().setVerticalMerge(CellMerge.NONE);

builder.getCellFormat().setHorizontalMerge(CellMerge.NONE);

builder.getCellFormat().setWidth(ConvertUtil.millimeterToPoint(5));

builder.getRowFormat().setBottomPadding(0);

builder.getParagraphFormat().setStyle(styleRow1);

builder.writeln("…");

builder.insertCell();

builder.getCellFormat().clearFormatting();

builder.getRowFormat().clearCellPadding();

builder.getCellFormat().setBottomPadding(0);

builder.getCellFormat().setTopPadding(0);

builder.getCellFormat().setVerticalMerge(CellMerge.NONE);

builder.getCellFormat().setWidth(ConvertUtil.millimeterToPoint(70));

builder.getParagraphFormat().setStyle(StyleRow2);

builder.writeln("…");







probably a bit too much formatters - but at least i got it running that way… :slight_smile:



thanks a lot and best regards,

christian

Hi Christian,

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. Could you please attach your output document (produced by your code) and the expected result (created in MS Word)? I will check the issue and provide you more information.

Best regards.

Hi Alex,

i got it - i hab some other problem here: while parsing the Source Document into my Aspose Document i had’ a flag set which changed the Style - and as the wrong stlye had some “SpaceBefore” settings i got this shift inside the table!



but thanks anyway…!



best regards,

christian