Hi All,
I have to create new slide in that slide with creating new table in programmatically and have to add text values in table td .....
Can anyone help me in this regard?
I am doing it using Asp.Net with C# and OpenXML SDK.
Any help? Thanks in anticipation....
Hi,
Try to create a table manually in PowerPoint 2007/2010. Initially you will see a content placeholder (Shape) which will have 6 icons in it (Table icon being the first). If you click on table icon, what happens inside is, the system captures the Transformation2D of the Shape and creates a GraphicFrame object with the same Transformation2D, then creates Grphic, GraphicData, Table and appends them in order. Finally it adds the GraphicFrame object to ShapeTree & deletes the referring Shape object from the ShapeTree. So, after adding the Table if you see the xml, in-place of Shape, you find GraphicFrame.
To add text within a table, you will need to create TableRow, TableCell, TextBody, Paragraph, Run->Text and append them in the order in which they got created.
I have attached a sample solution. Let me know if you face any problem with it.
Hi Pramodhegde,
Thank u........
in my requirment i cant able to create table manually because i have to create table slide in run time oly....so i just added the text box values in text without using table......
I am using above ur file its creating table in new slide.....but its creating in ur template file oly but i am using my company theme design so its showing Error
" Null Reference Exception was unhandled by user code"
"Object reference not set to an instance of an object."
*Error coming in this line oly
private static void AddTable(PresentationDocument prstDoc)
{
//.............
Shape tableShape = slide.CommonSlideData.ShapeTree.ChildElements.OfType<Shape>()
.Where(sh => sh.NonVisualShapeProperties.NonVisualDrawingProperties.Title.Value == "TableHolder").SingleOrDefault();
//............................
}
can u help me for this.......