Aspose.Slides.Table and formating


I’m currently creating a project where I need to transform data from excel to ppt. For this particular issue, I do NOT want to use OleObjectFrames. Instead, I want to pick a given table from one sheet in the Aspose.Cells.Workbook and create an Aspose.Slides.Table exactly like it.

For this to be of use, I need to recreate every styling and formating aspect of the sheet table in slide table. Thus, the problem… I’m having difficulties setting the vertical alignment of the slide table cells, as well as the style of the border lines. I can’t seem to find a method or some way to set the vertical alignment, and I also can’t seem to find a way to set the borders with the formating showed in the attached image.

Can you help with this?
Thanks in advance

For vertical alignment, please see this thread.

For setting borders, please see this thread.

Thanks, that was exactly it. Looks like I wasn’t too thorough searching the issue…

Oh, just another question… I was trying to search the forum, but I believe you are having some problems… here’s the result of the search:

We are currently unable to serve your request

We apologize, but an error occurred and your request could not be completed.

However, here’s the question… is there such a thing like autofit for Aspose.Slides.Table? I can’t seem to find a way to do it…

Thanks in advance,

Dear Cruz,

Try for searching, it will give you better results in searching posts related to your problems.

For example, I searched above two posts by similar text vertical alignment msfaiz

The site tag is restricting google to search only aspose site.

FYI, Table has cells and each cell has a textframe. TextFrame has properties like FitTextToShape and FitShapeToText, probably these are helpful in your case.

Dear Cruz,

Search engine issue has been fixed, feel free to use Aspose search, should you need to find anything on our site.

Hello again.

As you suggested, I tried all the ways I could come up with using the FitShapeToText property and the FitTextToShape() method. None provides me with what I need.
I have this Aspose.Cells table which I want converted to a Aspose.Slides.Table. For this purpose, I create a table in a slide with the corresponding number of rows and columns; then I iteratively scour through every cell of the table in the sheet and reproduce the various aspects of format in the table in the slide, like font color, size and name; cell borders color, line style, merges, etc. In the end of all this, I need to autofit the table in the slide to its contents, while invalidating the wrapping of text. For this I set every cell’s TextFrame.WrapText property to false and TextFrame.FitShapeToText property to true.

The result is in the attached image. As you can see, not only the cells aren’t fitted with their contents (visible in the 2nd column, for instance), but also the contents still appear wrapped (visible in the 1st column). I’ve just downloaded your latest version of both Aspose.Cells and Aspose.Slides.

I have tried matching a scale from the table in the sheet with the table in the slide, but the table in the sheet only gets its final widths and heights when the file is opened in excel, right? Because of this, when in runtime I cannot get these final widths and heights to match a scale.

Also, one more question… in this upgrade, I noticed that it is no longer possible to execute the following code:
table.GetCell(c, r).BorderBottom.LineFormat.ForeColor = Color.Black;
Can you tell me how to achieve this in this new version? I want to be able to set individual borders in cells, so table.SetBorders() won’t fit me.

Thanks in advance,

Dear Cruz,

You will have to shrink the table yourself, for this purpose; you can use Table.SetColumnWidth to set the individual width of columns.

For setting borders, please see this thread.