ToJSON
将 ApiTablePr 对象转换为 JSON 对象。
语法
expression.ToJSON();
expression - 表示 ApiTablePr 类的变量。
参数
此方法没有任何参数。
返回值
JSON
示例
将表格格式设置保存为文档中的可移植数据结构。
// How do I export table style properties so they can be stored or reused in a document?
// Serialize the table property configuration into a transferable format in a document.
let doc = Api.GetDocument();
let tableStyle = doc.CreateStyle("CustomTableStyle", "table");
tableStyle.SetBasedOn(doc.GetStyle("Bordered"));
let tablePr = tableStyle.GetTablePr();
let json = tablePr.ToJSON();
let tablePrFromJSON = Api.FromJSON(json);
let type = tablePrFromJSON.GetClassType();
let paragraph = doc.GetElement(0);
paragraph.AddText("Class type = " + type);