I have added a table in the slide and within the table, I have added a few rows with some text. The issue that I am facing is that I am not able to reduce spacing/margins between the cells. I can set top margin-bottom margin property after opening ppt and it works fine to reduce space between cells. But the same thing is not achievable through code. Below is the sample code that I am working on. Attached is the screenshot of the ppt table section that I am getting. Current output
ISlide sld = press.Slides[0];
// Define columns with widths and rows with heights
double[] dblC = { 300, 300 };
double[] dblR = { 70, 70, 70 };
ITable tblH = sld.Shapes.AddTable(100, 82, dblC, dblR);
tblH.FirstRow = false;
tblH.Rows[0].MinimalHeight = 0;
tblH.Rows[1].MinimalHeight = 0;
tblH.Rows[2].MinimalHeight = 0;
ITextFrame txtFrame = tblH[0, 0].TextFrame;
txtFrame.TextFrameFormat.MarginBottom = 50f;
IParagraph paragraph = txtFrame.Paragraphs[0];
IPortion portion = paragraph.Portions[0];
portion.PortionFormat.LatinFont = new FontData("Arial");
portion.PortionFormat.FontBold = NullableBool.True;
portion.Text = "Some Text";
portion.PortionFormat.FillFormat.FillType = FillType.Solid;
portion.PortionFormat.FillFormat.SolidFillColor.Color = Color.Black;
portion.PortionFormat.FontHeight = 8;
ITextFrame txtFrame1 = tblH[0, 1].TextFrame;
txtFrame1.TextFrameFormat.MarginTop = 30f;
IParagraph paragraph1 = txtFrame1.Paragraphs[0];
IPortion portion1 = paragraph1.Portions[0];
portion1.PortionFormat.LatinFont = new FontData("Arial");
portion1.PortionFormat.FontBold = NullableBool.True;
portion1.Text = "Some Text";
txtFrame1.TextFrameFormat.ColumnSpacing = 5f;
portion1.PortionFormat.FillFormat.FillType = FillType.Solid;
portion1.PortionFormat.FillFormat.SolidFillColor.Color = Color.Black;
portion1.PortionFormat.FontHeight = 6;
ITextFrame txtFrame2 = tblH[0, 2].TextFrame;
txtFrame2.TextFrameFormat.MarginTop = 30f;
IParagraph paragraph2 = txtFrame2.Paragraphs[0];
IPortion portion2 = paragraph2.Portions[0];
portion2.PortionFormat.LatinFont = new FontData("Arial");
portion2.PortionFormat.FontBold = NullableBool.True;
portion2.Text = "Some Text";
portion2.PortionFormat.FillFormat.FillType = FillType.Solid;
portion2.PortionFormat.FillFormat.SolidFillColor.Color = Color.Black;
portion2.PortionFormat.FontHeight = 5;
desired output would be that the spaces between cells should be reduced. Please suggest.
Can you please share the desired output presentation file that you want to generate using Aspose.Slides. I will investigate your requirements and will be able help you further in this regard on provision of requested information.
I have also observed your sample code and in that you are using TextFrame margins. I like to add here that when you are working with table cells, you need to set the margin for Table cell directly. I suggest you to please consider following modification in your code to observe the changes.
tblH[0, 0].MarginBottom=50f;
I am working as Support developer/ Evangelist at Aspose.