Free Support Forum - aspose.com

Table issues

I am creating a table using Aspose.Slides.table and in that table, the text is automatically wraping up the text. how can i stop this? Also i want to set the backgroupnd color to the cell. this color should be set at textframe level or cell level..

Hi,


Thanks for your interest in Aspose.Slides.

I have tried to observe your requirement related to wraping of text. Can you please share more details about the issue along with generated output and output what is required. Please also share that which version of Aspose.Slides you are using on your end.

For your second query related to setting the background color of the cell, please visit this link for your kind reference.

Many Thanks,

Hi Mudassir,

Thanks for getting back to me.

Basically i don't want to wrap the text in the statements column and want to fit the size of the cell to the size of the text.

So at the moment i am getting something like shown in pic 1.png.(Attached).

the code i am using for this is: (in .NET C#)

Cell tc = tbStatement.GetCell(columnPos, rowPos);

TextFrame tf = tc.TextFrame;

tf.WrapText = false;

tf.FitTextToShape();

But i want something like shown in Pic 2.png (Attached).

I am using Aspos.Slides Product version: 2010.08.12 File Version: 4.3.0.0

Let me know what do you think.

Thanks,

Mihir

Hi Mihir,


I have observed your requirement and like to share that the option for setting minimal row height in case of PPT is unavailable using Aspose.Slides. However, in case of PPTX, the feature was provided few product release ago. I would suggest you to please try using the latest version of Aspose.Slides for .NET 7.0.0 with following code. I am hopeful things will work for you.

public static void TableExAnchoring()
{
PresentationEx pres = new PresentationEx();
SlideEx slide = pres.Slides[0];
TableEx table = null;

int tableHeight = 300;
int tableWidth = 200;
int rowCount = 4;
int columnCount = 3;
double[] rowHeights = new double[rowCount];
double[] columnWidths = new double[columnCount];

double result = (8 / 4) / 8.0;

for (int i = 0; i < columnWidths.Length; i++)
{
columnWidths[i] = (tableWidth / columnCount);
}
for (int i = 0; i < rowHeights.Length; i++)
{
rowHeights[i] = (tableHeight / rowCount);
}


int tableIndex = slide.Shapes.AddTable(20, 40, columnWidths, rowHeights);
TableEx newTable = (TableEx)slide.Shapes[tableIndex];
foreach (RowEx row in newTable.Rows)
{
row.MinimalHeight = 5;
}

TextFrameEx textFrame = null;
for (int i = 0; i < rowCount; i++)
{
for (int j = 0; j < columnCount; j++)
{

textFrame = newTable[j, i].TextFrame;
textFrame.Paragraphs[0].Portions[0].Text = “Sample”;
textFrame.Paragraphs[0].Portions[0].Text = “Hello world. I am adding the Sample text. How are you. I will check the overlaping text”;
// textFrame.Paragraphs[0].Portions[0].PortionFormat.FontItalic = NullableBool.True;
textFrame.Paragraphs[0].Portions[0].PortionFormat.FontHeight = 8;
}

}

pres.Write(“D:\Aspose Data\modifedNew2.PPTX”);

}


Many Thanks,

Hi Mudssir,

Thanks for your concern. Can you suggest me some other options based on the version i have... Basically i don't want to wrap the text in the column 'Statements'. Also i can't set the width of the Cell object as it's saying it is read only.

Many Thanks,

Mihir

Hi Mihir,


I like to share that I have shared the possible workaround with you in my earlier post and this is one possible implementation. Secondly, the column width is read only and only row height is adjustable using MinimalHeight property. Actually, the column width is set on table creation time.

Many Thanks,