How to remove the border for a perticular cell and align text to center?

Hello,
I am facing some problems in reading the documentation. I am not finding what I exactly needed. These are simple things and hard to find.

I want to remove border for a particular cell and align text to center.

thanks
-Praveen
http://praveenbattula.blogspot.com

Hi Praveen,

Thanks for your interest in Aspose.Slides.

First of all please mention that whether you want to add the table in PPT or in PPTX. In PPT you can set the border on table level using the code snippet lined mentioned below. However, you can align the text of any particular cell to left, right, or center, individually because it is set on portion level. Please use the code snippet given below for text alignment issues.

int iWidth = 0;

table.SetBorders(iWidth, Color.Red);

Setting iWidth to '0' will hide the borders. Please use the following method for setting text style.

private static void setFontLook(int i, int j,Aspose.Slides.Table table)

{

table.GetCell(i, j).TextFrame.Paragraphs[0].Portions[0].FontIndex = 1;

table.GetCell(i, j).TextFrame.Paragraphs[0].Alignment = TextAlignment.Center;

table.GetCell(i, j).TextFrame.Paragraphs[0].Portions[0].FontBold = true;

table.GetCell(i, j).TextFrame.Paragraphs[0].Portions[0].FontColor = Color.Black;

table.GetCell(i, j).TextFrame.Paragraphs[0].Portions[0].FontHeight = 18;

}

Thanks and Regards,

Sorry there…
I want the border to be removed only for the cell in a table.
And I have solved the problem with below code.

Aspose.Slides.Cell cell1 = table.GetCell(0, 3);
RemoveBorder(cell1.BorderBottom);
RemoveBorder(cell1.BorderLeft);
RemoveBorder(cell1.BorderRight);

private void RemoveBorder(CellBorder border)
{
IEnumerator iter = border.GetEnumerator();
// Loop through all the lines
while (iter.MoveNext())
{
Aspose.Slides.Line line = (Aspose.Slides.Line)iter.Current;
line.LineFormat.ForeColor = Color.White;
// Setting the width of the top border
line.LineFormat.Width = 0;
}
}

This solved the problem and hope this helps someone else.

thanks
-Praveen
http://praveenbattula.blogspot.com

Hi Praveen,

I am really thankful to you for correcting me. We always admire the positive feedback and active participation from our customers. We shall make it part of documentation for our future reference.

Thanks and Regards,

Welcome.
I have read the documentation and found it. It’s common that anyone don’t about everything. So, sometimes this happens… Solving the problem is important, no matter what who solved the problem. Helping each other is what make successful in anything.

-Praveen
http://praveenbattula.blogspot.com