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

Free Support Forum - aspose.com

How to change the font size of text in tables?

Hi


I want to make the text of a table smaller in a slide.
I have no idea how to achieve this.

The following is my code, but it didn’t work.

foreach (IShape sh in slide.Shapes)
{
if (sh is ITable)
{
ITable table = sh as ITable;
table.ShapeLock.SizeLocked = false;
foreach(IRow row in table.Rows)
{
foreach (ICell cell in row.AsICellCollection)
{

cell.TextFrame.Paragraphs[0].Portions[0].PortionFormat.FontHeight = 5;

}
}
}
}

Please help me to figure it out, thanks :slight_smile:

Hi Craig,


I have observed the sample code shared by you and it is workable in some scenarios but not all of them. Actually, every text frame can have collection of paragraphs and every paragraph can have collection of portions. In your approach you are only targeting first portion of first paragraph inside the text frame only. You may please need to revise the approach by looping through all paragraphs and then every portion inside those all paras. I hope this will clarify the concept. Please share, if I may help you further in this regard.

Many Thanks,
Hi Mudassir

I changed my code like following:
foreach (IShape sh in slide.Shapes)
{
if (sh is ITable)
{
ITable table = sh as ITable;
table.ShapeLock.SizeLocked = false;
foreach(IRow row in table.Rows)
{
foreach (ICell cell in row.AsICellCollection)
{

foreach (IParagraph pragraph in cell.TextFrame.Paragraphs)
{
foreach (IPortion portion in pragraph.Portions)
{
portion.PortionFormat.FontHeight =2;
}
}

}
}
}
}

And I was trying to convert this slide to svg file, but it seems that these code doesn't affect the font size of the result svg.

Please help my to fix this problem

Hi Craig,


I request you to please try using Aspose.Slides for .NET 15.1.0 on your end first. If there is still an issue then please share the working sample project reproducing the issue on your end along with output svg file. I will add a ticket in our issue tracking system to further investigate and resolve that then.

Many Thanks,

Hi Mudassir

I am using Slides 15.1.0
And the attachement is the zipfile contains the project, ppt File, and result svg File
I remove the dlls, so that the atachement won’t be too large.

This problem still exists, please check it, thanks :slight_smile:

Hi Craig,

I have worked with the presentation and sample project shared by you and have been able to observe the issue specified in generated SVG. An issue with ID SLIDESNET-36149 has been created in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be automatically notified once the issue will be resolved.

We are sorry for your inconvenience,

Hi Mudassir


Furthermore, there are some problems:

1. I have the a ppt file in attachement conveted to svg files, and there is a result svg file goes wrong. Its text of table has been enlarged, and lost the origin fontstyle.

Presentation pre = new Presentation("…/…/test.ppt");
int count = 1;
foreach(ISlide slide in pre.Slides)
{
slide.WriteAsSvg(new FileStream("…/…/"+count+".svg", FileMode.OpenOrCreate));
count++;
}


2. I save the slides to ptt files one by one, one of the new ppt files has the problem as the same of above.

Presentation pre = new Presentation("…/…/test.ppt");
int count = 1;
foreach(ISlide slide in pre.Slides)
{
Presentation tpPre = new Presentation();
tpPre.Slides.AddClone(slide);
tpPre.Slides.RemoveAt(0);
tpPre.Save("…/…/"+count+".pptx", Aspose.Slides.Export.SaveFormat.Pptx);
count++;
}

Please help me to fix this problem, thanks :slight_smile:

Hi Craig,


I have worked with new presentation and sample code shared by you. The sample code 1 is depiction of same font related issue already added. I have worked with second code sample that is only splitting the slides from source presentation to individual presentations. It works as expected as given in code. Can you please share what behavior second code sample must have exhibited as IMO, it is simply splitting presentation to individual slides.

Many Thanks,

Hi Mudassir


Please take a look at 7th one of splitted presentation after splitting.

The text of the table is enlarged and the font style is changed.

I have some images attached.
I hope that my reply helps you find the problem :slight_smile:



Hi Craig,

Thanks for sharing the additional details. I have observed the issue specified and an issue with ID SLIDESNET-36160 has been created in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be automatically notified once the issue will be resolved.

We are sorry for your inconvenience,

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


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

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


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