表格单元格中文字的右对齐

时间:2018-11-30 13:51:39

标签: aspose aspose.words

我这样填充单词表(下面的代码)。而且我想在变量运行中向右对齐插入文本。我尝试了很多事情,但是没有任何效果。你能帮忙吗?

var entryTable = bm.getBookmarkStart().getAncestor(com.aspose.words.NodeType.TABLE);
if (entryTable != null) {
    var myArray = ['A', 'B', 'C', 'D', 'E'];
    var passes = myArray.length;
    var index = 1;
    while (...(id, myArray[0]+index)!="")
    {      
        var cRow = entryTable.getLastRow().deepClone(true);
        for (var j = 0; j < passes; j++) {       
            var run = cRow.getCells().get(j).getFirstParagraph().getRuns().get(0).deepClone(true);
            var key = ...(id, myArray[j]+index);
            run.setText(key);
            cRow.getCells().get(j).removeAllChildren();
            cRow.getCells().get(j).ensureMinimum();
            cRow.getCells().get(j).getParagraphs().get(0).appendChild(run);
        }
        index++;
        entryTable.appendChild(cRow);     
    }
    entryTable.getRows().get(1).remove();
} else {
    log.warn(LOG_PREFIX + "...");
}

1 个答案:

答案 0 :(得分:0)

您可以使用以下代码在表格单元格中将所有段落右对齐。

contexts:
  main:
    - match: '\|\h+\K\w+[^|\s]+(?:[,\/]?\h*\w+)*(?=\h*(?:\||$))'         
      scope: markup.heading

希望,这会有所帮助。我和Aspose一起担任开发人员推广人员。