Font size and type changes of table while inserting document containing table using keep source formatting in target document in case of table has font Times New Roman

font size and type changes of table while inserting document containing table using keep source formatting in target document in case of table has font Times New Roman.

I am using aspose-words 22.2 java version.

uploading different type of document with different font

Please compare font type and size of table’s first row in the target and source document

String path = "/data/documentIssue/SourceDocument.docx";
Document parentClauseDocument = new Document(path);

Document document = new Document();
DocumentBuilder builder = new DocumentBuilder(document);

builder.insertDocument(parentClauseDocument, ImportFormatMode.KEEP_SOURCE_FORMATTING);
document.save("/data/documentIssue/targetDocument.docx");

tableWithArialFont.docx (15.9 KB)
tableWithHeaderTimeNewRomanAndArialFont.docx (15.9 KB)
tableWithAllTimeNewRomanFont.docx (15.9 KB)

@mohitkumar1991 sorry I can’t reproduce your issue, I’m using the API version 23.3.
You probably don’t have the required font installed in your environment, if Aspose.Words don’t found the required fonts it replace that font with another. To check if font substitutions are happening in your environment please implement IWarningCallback interface:

public class AppendIssueCallBack implements IWarningCallback {
    
    @Override
    public void warning(WarningInfo info) {
        System.out.println(info.getDescription());
    }
}
document.setWarningCallback(new AppendIssueCallBack());

I have installed source document format “TimesNewRoman” and also used above interface as mentioned but issue still exist and no logs using interface.

If TimesNewRoman would not have at my machine, then how come it is showing that TimeNewRoman was font in source document. It is coming only for table.

@mohitkumar1991 I still cannot reproduce your problem, can you please provide more datils about the environment in where the application run, and please make sure that you are using the latest version of the API.
This is the code that use and the outputs that it generate:

Document destDoc = new Document();
Document sourceDoc = new Document("C:\\Temp\\tableWithHeaderTimeNewRomanAndArialFont.docx");
destDoc.setWarningCallback(new AppendIssueCallBack());

DocumentBuilder builder = new DocumentBuilder(destDoc);
builder.moveToSection(0);
builder.insertDocument(sourceDoc, ImportFormatMode.KEEP_SOURCE_FORMATTING);

destDoc.save("C:\\Temp\\tableWithHeaderTimeNewRomanAndArialFont_output.docx", SaveFormat.DOCX);

tableWithAllTimeNewRomanFont_output.docx (11.2 KB)
tableWithArialFont_output.docx (11.3 KB)
tableWithHeaderTimeNewRomanAndArialFont_output.docx (11.3 KB)

We tried with latest aspose as provide, but issue was also reproducing.
OS: Version: ubuntu 20.04

@mohitkumar1991 Thank you for provide additional information. I am trying to setup a virtual environment in order to replicate your problem I will back to you as soon as possible.