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

Free Support Forum - aspose.com

Table min row height < 10- table collapses on clone

Hi,


I have a table where I know the column widths but I don’t know the row heights. I output user entered text so each cell can have a different font height. I want the rows to grow as needed. I set a tiny minimum row height, so that the row will grow. If I set a larger minimum height it correctly doesn’t shrink.

The rows grow as expected on the first slide. When I clone the slide, if the minimum row height is under 10, the entire table collapses and all the text is on top of each other.

This only occurs for PPT. PPTX creates an exact clone of the first table.

Thank-you for your time.



Slide slide1 = (Slide) _presentation.Slides[0];

double[] dblCols = { 100, 100, 100 };

//
// not working
//
double[] dblRows = { 9, 9, 9 };

//
// working
//
//double[] dblRows = { 10, 10, 10 };

ITable tbl = slide1.Shapes.AddTable(100, 50, dblCols, dblRows);

foreach (IRow row in tbl.Rows) {
foreach (ICell cell in row) {

cell.TextFrame.Paragraphs[0].Portions[0].PortionFormat.FillFormat.FillType = FillType.Solid;
cell.TextFrame.Paragraphs[0].Portions[0].PortionFormat.FillFormat.SolidFillColor.Color = Color.Black;

cell.BorderTop.FillFormat.FillType = FillType.Solid;
cell.BorderTop.FillFormat.SolidFillColor.Color = Color.Red;
cell.BorderTop.Width = 1;

cell.BorderBottom.FillFormat.FillType = FillType.Solid;
cell.BorderBottom.FillFormat.SolidFillColor.Color = Color.Red;
cell.BorderBottom.Width = 1;

cell.BorderLeft.FillFormat.FillType = FillType.Solid;
cell.BorderLeft.FillFormat.SolidFillColor.Color = Color.Red;
cell.BorderLeft.Width = 1;

cell.BorderRight.FillFormat.FillType = FillType.Solid;
cell.BorderRight.FillFormat.SolidFillColor.Color = Color.Red;
cell.BorderRight.Width = 1;
}
}

tbl[0, 0].TextFrame.Paragraphs[0].Portions[0].Text = “0,0”;
tbl[1, 0].TextFrame.Paragraphs[0].Portions[0].Text = “1,0”;
tbl[2, 0].TextFrame.Paragraphs[0].Portions[0].Text = “2,0”;

tbl[0, 1].TextFrame.Paragraphs[0].Portions[0].Text = “0,1”;
tbl[1, 1].TextFrame.Paragraphs[0].Portions[0].Text = “some really long text to make the cell height increase”;
tbl[2, 1].TextFrame.Paragraphs[0].Portions[0].Text = “2,1”;

tbl[0, 2].TextFrame.Paragraphs[0].Portions[0].Text = “0,2”;
tbl[1, 2].TextFrame.Paragraphs[0].Portions[0].Text = “1,2”;
tbl[2, 2].TextFrame.Paragraphs[0].Portions[0].Text = “2,2”;

Slide slide2 = (Slide) _presentation.Slides.AddClone(slide1);

Hi David,


I have observed the issue statement shared by you and have not been able to completely understand the requirement shared by you. Can you please share the working sample project along with source presentation, generated porblematic presentation and desired output presentation. I will investigate the issue further on my in light of information shared by you to help you out.

Many Thanks,

Hi Mudassir,


I have attached a PPT that is generated using the code included in the original post.

My issue is that if I clone the entire slide, the table on the cloned slide has all the rows on top of each other. If I set the minimum row height to be 10 or greater, this behaviour does not occur. If the row height is 9 or smaller, then this error will occur. Some of my table rows contain a single horizontal line so a small row height is desired if possible.

Thanks.

Hi David,

I have worked with the sample code shared by you using Aspose.Slides for .NET 15.8.0 on end. The issue is not reproduced on my end using the specified version. For your kind reference, I have attached the used sample code as well as generated presentations.

public static void TestMinimalHeight()
{
Presentation _presentation = new Presentation();
Slide slide1 = (Slide)_presentation.Slides[0];

double[] dblCols = { 100, 100, 100 };

//
// not working
//
double[] dblRows = { 9, 9, 9 };

//
// working
//
//double[] dblRows = { 10, 10, 10 };

ITable tbl = slide1.Shapes.AddTable(100, 50, dblCols, dblRows);

foreach (IRow row in tbl.Rows)
{
foreach (ICell cell in row)
{

cell.TextFrame.Paragraphs[0].Portions[0].PortionFormat.FillFormat.FillType = FillType.Solid;
cell.TextFrame.Paragraphs[0].Portions[0].PortionFormat.FillFormat.SolidFillColor.Color = Color.Black;

cell.BorderTop.FillFormat.FillType = FillType.Solid;
cell.BorderTop.FillFormat.SolidFillColor.Color = Color.Red;
cell.BorderTop.Width = 1;

cell.BorderBottom.FillFormat.FillType = FillType.Solid;
cell.BorderBottom.FillFormat.SolidFillColor.Color = Color.Red;
cell.BorderBottom.Width = 1;

cell.BorderLeft.FillFormat.FillType = FillType.Solid;
cell.BorderLeft.FillFormat.SolidFillColor.Color = Color.Red;
cell.BorderLeft.Width = 1;

cell.BorderRight.FillFormat.FillType = FillType.Solid;
cell.BorderRight.FillFormat.SolidFillColor.Color = Color.Red;
cell.BorderRight.Width = 1;
}
}

tbl[0, 0].TextFrame.Paragraphs[0].Portions[0].Text = “0,0”;
tbl[1, 0].TextFrame.Paragraphs[0].Portions[0].Text = “1,0”;
tbl[2, 0].TextFrame.Paragraphs[0].Portions[0].Text = “2,0”;

tbl[0, 1].TextFrame.Paragraphs[0].Portions[0].Text = “0,1”;
tbl[1, 1].TextFrame.Paragraphs[0].Portions[0].Text = “some really long text to make the cell height increase”;
tbl[2, 1].TextFrame.Paragraphs[0].Portions[0].Text = “2,1”;

tbl[0, 2].TextFrame.Paragraphs[0].Portions[0].Text = “0,2”;
tbl[1, 2].TextFrame.Paragraphs[0].Portions[0].Text = “1,2”;
tbl[2, 2].TextFrame.Paragraphs[0].Portions[0].Text = “2,2”;

Slide slide2 = (Slide)_presentation.Slides.AddClone(slide1);

_presentation.Save(“D:\Aspose Data\TestHeight.pptx”, SaveFormat.Pptx);
_presentation.Save(“D:\Aspose Data\TestHeight.ppt”, SaveFormat.Ppt);

}


Many Thanks,

Hi Mudassir,


Thank-you for trying again. I have worked around this issue in my code.

Thanks again.

Hi David,

Thank you for feedback.

We are glad to know your issue is resolved and you are no more facing the problem. Feel free to contact us if we could be of any help to you.

Many Thanks,