ToJSON
Converts the ApiTable object into the JSON object.
Parameters:
Name |
Type |
Default |
Description |
bWriteTableStyles |
bool
|
false |
Specifies whether to write used table styles to the JSON object (true) or not (false). |
Returns:
- Type
-
JSON
Example
Copy code
builder.CreateFile("pptx");
var oPresentation = Api.GetPresentation();
var oSlide = oPresentation.GetSlideByIndex(0);
oSlide.RemoveAllObjects();
var oTable = Api.CreateTable(2, 4);
let json = oTable.ToJSON(true);
var oTableFromJSON = Api.FromJSON(json);
var sType = oTableFromJSON.GetClassType();
var oRow = oTableFromJSON.GetRow(0);
var oCell = oRow.GetCell(0);
var oContent = oCell.GetContent();
var oParagraph = Api.CreateParagraph();
oParagraph.AddText("Class type = " + sType);
oContent.Push(oParagraph);
oSlide.AddObject(oTableFromJSON);
builder.SaveFile("pptx", "ToJSON.pptx");
builder.CloseFile();
Resulting document