Plugins 如何使用ONLYOFFICE API在演示文稿中添加表?

Plugins 如何使用ONLYOFFICE API在演示文稿中添加表?,plugins,presentation,onlyoffice,Plugins,Presentation,Onlyoffice,我们正在尝试使用演示文稿编辑器插件中的ONLYOFFICE API添加表。我们可以用文档编辑器轻松地完成这项工作,但无法找到演示文稿的方法 我们尝试使用附加的脚本插入一个表,但它不起作用。我们在DocumentBuilder中也尝试了同样的方法,但在创建文档时遇到了一个错误 我们尝试了以下方法: oDocContent.InsertContent([oTable]); 及 使用以下脚本,我们尝试在演示文稿编辑器中插入一个表 脚本1: builder.CreateFile("pptx")

我们正在尝试使用演示文稿编辑器插件中的ONLYOFFICE API添加表。我们可以用文档编辑器轻松地完成这项工作,但无法找到演示文稿的方法

我们尝试使用附加的脚本插入一个表,但它不起作用。我们在DocumentBuilder中也尝试了同样的方法,但在创建文档时遇到了一个错误

我们尝试了以下方法:

   oDocContent.InsertContent([oTable]); 

使用以下脚本,我们尝试在演示文稿编辑器中插入一个表

脚本1:

builder.CreateFile("pptx");
var oPresentation = Api.GetPresentation();
var oParagraphCell, oTable, oTableStyle, oCell, oTableRow, oParagraph;
var oSlide = oPresentation.GetSlideByIndex(0);
oSlide.RemoveAllObjects();
var oShape = Api.CreateShape("rect", 300 * 36000, 130 * 36000, oFill, oStroke);
oShape.SetPosition(608400, 1267200);
oDocContent = oShape.GetDocContent();
oParagraph = oDocContent.GetElement(0);
oParagraph.AddText("This is an example of the ppt.");
oParagraph = Api.CreateParagraph();
oDocContent.InsertContent([oParagraph]);
oTableStyle = oDocContent.CreateStyle("CustomTableStyle", "table");
oTableStyle.SetBasedOn(oDocument.GetStyle("Bordered - Accent 5"));
oTable = Api.CreateTable(3, 3);
oTable.SetWidth("percent", 100);
oTableRow = oTable.GetRow(0);
oTableRow.SetHeight("atLeast", 1440);
oCell = oTable.GetRow(0).GetCell(0);
oCell.SetVerticalAlign("top");
oParagraphCell = oCell.GetContent().GetElement(0);
oParagraphCell.AddText("Align top");
oCell = oTable.GetRow(0).GetCell(1);
oCell.SetVerticalAlign("center");
oParagraphCell = oCell.GetContent().GetElement(0);
oParagraphCell.AddText("Align center");
oCell = oTable.GetRow(0).GetCell(2);
oCell.SetVerticalAlign("bottom");
oParagraphCell = oCell.GetContent().GetElement(0);
oParagraphCell.AddText("Align bottom");
oTable.SetStyle(oTableStyle);
oDocContent.InsertContent([oTable]);
oSlide.AddObject(oShape);
builder.SaveFile("pptx", "SampleText.pptx");
builder.CloseFile();
脚本2:

builder.CreateFile("pptx");
var oPresentation = Api.GetPresentation();
var oParagraphCell, oTable, oTableStyle, oCell, oTableRow, oParagraph;
var oSlide = oPresentation.GetSlideByIndex(0);
oSlide.RemoveAllObjects();
oFill = Api.CreateSolidFill(Api.CreateRGBColor(61, 74, 107));
oStroke = Api.CreateStroke(0, Api.CreateNoFill());
var oShape = Api.CreateShape("rect", 300 * 36000, 130 * 36000, oFill, oStroke);
oShape.SetPosition(608400, 1267200);
oDocContent = oShape.GetDocContent();
oParagraph = oDocContent.GetElement(0);
oParagraph.AddText("This is an example of the ppt.");
oTableStyle = oDocContent.CreateStyle("CustomTableStyle", "table");
oTableStyle.SetBasedOn(oDocContent.GetStyle("Bordered - Accent 5"));
oTable = Api.CreateTable(3, 3);
oTable.SetWidth("percent", 100);
oTableRow = oTable.GetRow(0);
oTableRow.SetHeight("atLeast", 1440);
oCell = oTable.GetRow(0).GetCell(0);
oCell.SetVerticalAlign("top");
oParagraphCell = oCell.GetContent().GetElement(0);
oParagraphCell.AddText("Align top");
oCell = oTable.GetRow(0).GetCell(1);
oCell.SetVerticalAlign("center");
oParagraphCell = oCell.GetContent().GetElement(0);
oParagraphCell.AddText("Align center");
oCell = oTable.GetRow(0).GetCell(2);
oCell.SetVerticalAlign("bottom");
oParagraphCell = oCell.GetContent().GetElement(0);
oParagraphCell.AddText("Align bottom");
oTable.SetStyle(oTableStyle);
oDocContent.Push(oTable);
oSlide.AddObject(oShape);
builder.SaveFile("pptx", "SampleText.pptx");
builder.CloseFile();
如何使用ONLYOFFICE API在演示文稿中添加表

我们可以用文档编辑器轻松地做到这一点,但无法做到 找到一种展示的方式

很快,您还可以在ONLYOFFICE演示文稿中添加表格。 计划在下一个版本中进行。
与ONLYOFFICE支持团队保持联系,他们会让您知道。

预计发布时间框架是什么?所以我们应该相应地安排!!将包含在5.2版中(预计于2018年夏季发布)
builder.CreateFile("pptx");
var oPresentation = Api.GetPresentation();
var oParagraphCell, oTable, oTableStyle, oCell, oTableRow, oParagraph;
var oSlide = oPresentation.GetSlideByIndex(0);
oSlide.RemoveAllObjects();
oFill = Api.CreateSolidFill(Api.CreateRGBColor(61, 74, 107));
oStroke = Api.CreateStroke(0, Api.CreateNoFill());
var oShape = Api.CreateShape("rect", 300 * 36000, 130 * 36000, oFill, oStroke);
oShape.SetPosition(608400, 1267200);
oDocContent = oShape.GetDocContent();
oParagraph = oDocContent.GetElement(0);
oParagraph.AddText("This is an example of the ppt.");
oTableStyle = oDocContent.CreateStyle("CustomTableStyle", "table");
oTableStyle.SetBasedOn(oDocContent.GetStyle("Bordered - Accent 5"));
oTable = Api.CreateTable(3, 3);
oTable.SetWidth("percent", 100);
oTableRow = oTable.GetRow(0);
oTableRow.SetHeight("atLeast", 1440);
oCell = oTable.GetRow(0).GetCell(0);
oCell.SetVerticalAlign("top");
oParagraphCell = oCell.GetContent().GetElement(0);
oParagraphCell.AddText("Align top");
oCell = oTable.GetRow(0).GetCell(1);
oCell.SetVerticalAlign("center");
oParagraphCell = oCell.GetContent().GetElement(0);
oParagraphCell.AddText("Align center");
oCell = oTable.GetRow(0).GetCell(2);
oCell.SetVerticalAlign("bottom");
oParagraphCell = oCell.GetContent().GetElement(0);
oParagraphCell.AddText("Align bottom");
oTable.SetStyle(oTableStyle);
oDocContent.Push(oTable);
oSlide.AddObject(oShape);
builder.SaveFile("pptx", "SampleText.pptx");
builder.CloseFile();