When creating multiple tables using the ‘CreateTable’ API, refreshing the page causes the border of the first table to become a dashed line.
var oTable = Api.CreateTable(2, 4);
oTable.SetWidth('percent', 100);
let tableStyle = oDocument.CreateStyle('CustomTableStyle', 'table');
tableStyle.GetTablePr().SetTableBorderTop('single', 2, 0, 0, 0, 0);
tableStyle.GetTablePr().SetTableBorderBottom('single', 2, 0, 0, 0, 0);
tableStyle.GetTablePr().SetTableBorderLeft('single', 2, 0, 0, 0, 0);
tableStyle.GetTablePr().SetTableBorderRight('single', 2, 0, 0, 0, 0);
tableStyle.GetTablePr().SetTableBorderInsideV('single', 2, 0, 0, 0, 0);
tableStyle.GetTablePr().SetTableBorderInsideH('single', 2, 0, 0, 0, 0);
let tableStylePr = tableStyle.GetConditionalTableStyle('wholeTable');
tableStylePr.GetTableRowPr().SetHeight('auto');
oTable.SetStyle(tableStyle);
let cellWidth = Math.floor(100 / oTable.GetRow(0).GetCellsCount());
for (var row = 0; row < oTable.GetRowsCount(); row++) {
for (var col = 0; col < oTable.GetRow(row).GetCellsCount(); col++) {
var oCell = oTable.GetRow(row).GetCell(col);
oCell.SetWidth('percent', cellWidth);
var oPara = oCell.GetContent().GetElement(0);
oPara.SetStyle(sTable);
}
}
ONLYOFFICE Version: 9.0.0