C# conversion

Here's the original code and I want to convert it to C#. Any helps is appreciated.

With ppApp.ActivePresentation.Slides(0).Shapes(0).Table.Cell(1,1).Shape.TextFrame
With .TextRange.Characters(1,0)
.Text = "Rank"
With .Font
.name = "Arial"
.size = 12
.Bold = 1
End With
End With
End With

Here is the equivalent C# code in Aspose.Slides.

See the source and output presentation generated by the code below.

Presentation ActivePresentation = new Presentation("source.ppt");

//Get the first slide, which starts from 1 and goes onward

Slide slide = ActivePresentation.GetSlideByPosition(1);

//Get a table shape, assume it is the first shape

Table tbl = slide.Shapes[0] as Table;

//Get 1,1 cell

Cell cell = tbl.GetCell(1, 1);

//Get cell's textframe

TextFrame tf = cell.TextFrame;

//Get the first paragraph

Paragraph para = tf.Paragraphs[0];

//Get the first portion inside it

Portion port = para.Portions[0];

//Set the formatting

//Assume first font is Arial in Presentation.Fonts collection

//For newer fonts add FontEntity objects and set the below

//index accordingly

port.FontIndex = 0;

port.FontBold = true;

port.FontHeight = 12;

//Write presentation on disk.


Thank Shakeel! I was able to use your code without any problem. Is there a property that allow me to display my text vertically in my table cell?

Yes, there is. Please see this thread for vertical alignment.

Hi Shakeel,

Can you show me how to append additional rows in the middle of a table in the body section of a document? I wanted to programmatically insert 5 more rows in the middle of a 10x6 table; not at the end of the table.



I’m afraid that is not possible.

I got it to work!!! Here's how I did it...

for (int i = 1; i < LookUpRow.Length; i++)


Row newRow = (Row)doc.Sections[secNum].Body.Tables[0].Rows[7].Clone(true);

doc.Sections[secNum].Body.Tables[0].InsertAfter(newRow, doc.Sections[secNum].Body.Tables[0].Rows[6 + i]);