简体   繁体   English

使用正位词将一个单词分为2行

[英]a word is divided into 2 line using aspose words

when I use aspose words to draw a table, I find that sometimes one word is divided into 2 lines in a table cell. 当我使用aspose单词绘制表格时,我发现有时一个单词在表格单元格中分为2行。 for instance the "organisation registration" string is displayed like 例如,“组织注册”字符串显示为

organisation 组织

n ñ

registration 注册

in a cell, ie, the word "Organisation" is separated into 2 lines. 在一个单元格中,即“组织”一词分为两行。

but I hope it should be displayed like 但我希望它应该像

organisation 组织

registration 注册

my code is 我的代码是

    Document doc = new Document();
    DocumentBuilder builder = new DocumentBuilder(doc);
    builder.getFont().setName(DEFAULT_FONT);
    builder.getFont().setSize(14);
    builder.getFont().setBold(true);
    builder.getFont().setColor(Color.BLACK);
    Table table = builder.startTable();
    // Organisation registration
    builder.insertCell();
    // Table wide formatting must be applied after at least one row is present in the table.
    // set borders
    table.setBorder(BorderType.TOP, LineStyle.SINGLE, 1.5, Color.BLACK, true);
    table.setBorder(BorderType.BOTTOM, LineStyle.SINGLE, 1.5, Color.BLACK, true);
    table.setBorder(BorderType.LEFT, LineStyle.NONE, 0, Color.BLACK, true);
    table.setBorder(BorderType.RIGHT, LineStyle.NONE, 0, Color.BLACK, true);
    table.setBorder(BorderType.HORIZONTAL, LineStyle.NONE, 0, Color.BLACK, true);
    table.setBorder(BorderType.VERTICAL, LineStyle.NONE, 0, Color.BLACK, true);

    builder.getCellFormat().setVerticalMerge(CellMerge.FIRST);
    builder.write("Organisation registration");
    builder.insertCell();
    builder.getCellFormat().setVerticalMerge(CellMerge.NONE);
    builder.write("Legal name");
    builder.insertCell();
    builder.write(wgeaReportFactModel.getOrgName());
    builder.endRow();

does anyone know how to fix this? 有谁知道如何解决这一问题?

thanks 谢谢

I tried your scenario with the latest version of Aspose.Words and it works fine. 我使用最新版本的Aspose.Words尝试了您的情况,并且工作正常。 You can download it from here and give it a try. 您可以从这里下载并尝试一下。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM