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

Free Support Forum - aspose.com

Slide-Insert Table data-First row in table is coming in font bold

Hi Team,

We are using aspose slide for creating and inserting of table content. But the first row is coming in Bold. No where we are setting this as Bold in the code.

Iam attching the generated pptx for your reference & code snippet

Below is the code snippet:

public static void insertTableForTOC(final SlideEx slide, final Element tableShapeElement, final String shapeID) {
final ShapeEx tableShape = PPTUtil.findShape(slide, shapeID);
final float xCoord = tableShape.getX();
final float yCoord = tableShape.getY();
final NodeList rowNodeList = tableShapeElement.getElementsByTagName(PPTUtil.TABLE_ROW);
final int rowCnt = rowNodeList.getLength();
final Element tempRowEle = (Element) rowNodeList.item(0);
final NodeList tempCellNodeList = tempRowEle.getElementsByTagName(PPTUtil.TABLE_CELL);
double[] dblCols = new double[tempCellNodeList.getLength()];
double[] dblRows = new double[rowCnt];
for (int i = 0; i < dblRows.length; i++) {
dblRows[i] = 10;
for (int i = 0; i < dblCols.length; i++) {
dblCols[i] = 10;
final int id = slide.getShapes().addTable(xCoord, yCoord, dblCols, dblRows);
final TableEx table =(TableEx) slide.getShapes().get_Item(id);
RowEx row=table.getRows().get_Item(0);
for(int rCnt = 0; rCnt < rowCnt; rCnt++){
final Element rowEle = (Element) rowNodeList.item(rCnt);
final NodeList rowCellNodeList = rowEle.getElementsByTagName(PPTUtil.TABLE_CELL);
for (int i = 0; i < rowCellNodeList.getLength(); i++) {
final CellEx cell=row.get_Item(i);
final ColumnEx col = table.getColumns().get_Item(i);
if(rowCellNodeList.item(i).getFirstChild() != null){
String cellText = rowCellNodeList.item(i).getFirstChild().getNodeValue();
cellText = cellText.trim();

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

Thank you for sharing the sample file and code.

First of all, it is the default behavior of MS PowerPoint as well that when you add a new table, the first row i.e. the header row has bold font. However, MS PowerPoint does provide an option to enable or disable the header row which is not supported at the moment in Aspose.Slides for Java. A new feature request has been registered in our issue tracking system with issue id: SLIDESJAVA-34360. As a work around, you can set the font of the cells as non bold by adding the following line of code where you are formatting the cells:


The above line will make the font non bold in all the cells of the table. Please feel free to contact support in case you need any further assistance.

Thanks & Regards,

The issues you have found earlier (filed as SLIDESJAVA-34360) have been fixed in this update.

This message was posted using Notification2Forum from Downloads module by Aspose Notifier.