Free Support Forum - aspose.com

Print preview and printing slides containing tables

Attached is a PowerPoint Presentation created using aspose.slides. Most of the cell borders are not shown. Using this code:

c.getBorderXXX().getLineFormat().setShowLines(false), where XXX is Top, Bottom, Left and/or Right.

First problem: previewing shows all borders for all cells. The first empty cell looks almost correct.

Second problem: printing the slide shows all borders for all cells.

In both cases I am using MS PowerPoint 2002. Are they bugs or are they related to the eval license I have? Please help.

It looks like ppt files have 2 different fields for lines visibility.
The first is show lines on screen and the second is show lines on printer (or print preview).

setShowLines() function changes only first one.
We will support both properties in the next hot fix.

Could you explain how this table was created? Is it created from scratch or from template?
If it’s created from template can you send me the source presentation?

The table is created form scratch.

Table table = shapes.addTable(X, Y, 10*576, 8*576, 40, 9);
The source Presentation does not have any table holder.

Why 40x9? Your table is 7x7 only. I’d like to know how you set borders.
I couldn’t reproduce it. I created the same table from scratch, filled with data
and set the same borders. But in my table I don’t have borders which are visible
on print preview.

The number of columns and rows does not matter: 7x7 or 40x9 or any other combination.
The border lines are shown in print preview. I tried it in XP and W2k.

Here is the code where I set the cell borders. Similar code is used for Bottom, Left and Right borders:

public static void borders(Cell c, FoCell fc) {
    LineFormat lineFormat = c.getBorderTop().getLineFormat();
    if(isPropertyEnabled(fc.getTopBoder())){

        lineFormat.setShowLines(true);
        lineFormat.setStyle(LineStyle.SINGLE);
        lineFormat.setWidth(0.4);
        if(isPropertyEnabled(fc.getTopBoderColor())){
            lineFormat.setForeColor(ColorUtil.getColor(fc.getTopBoderColor()));
        }
    }else{

        lineFormat.setShowLines(false);
    }
    ...

}


Can you share your test code?

Hi Alexey,

I found the cause. The problem happens whenever I set the background color for a cell to fill type SOLID. In my case I am setting the bg color for all cells in the table. Here is the code that sets the background color.

c.getFillFormat().setForeColor(ColorUtil.getColor(fc.getBackgroundColor()));
c.getFillFormat().setType(FillType.SOLID);

Please let me know if this is not the right way.

When I use other fill types (GRADIENT, PATTERN, TEXTURE) I get the correct output in print preview (tomorrow I will test printing). So, the problem is only with FillType.SOLID.

Another finding, I think, this is also causing errors in powerpoint 2000. Our slides does not open when the cells background are set to SOLID (I will double check powerpoint 2000 with the other fill types). In XP it is ok.

Thank you for the help. It looks like we fixed the very old floating bug when PowerPoint 2000
couldn’t open slides with tables or threw strange errors.

Black lines on print preview is not a problem of Aspose.Slides.
Simply try to create table in MS PowerPoint, make all borders invisible and fill all cells with white color (0xFFFFFF).
On print preview all lines will be shown. Also it depends on printer driver. For example lines are visible if you try
to print on b/w printer (HP LaserJet in my case) and can be invisible on some color printers.
If you fill cells with any other color (for example 0xFEFEFE) lines are always invisible.