简体   繁体   中英

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. 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. You can download it from here and give it a try.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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