When I was using 'sourceStyles', I found that when the content completely filled a page, there would be an extra new line. What should I do?when i use

example

test <<doc [genes11_references] -sourceStyles>> 

this sourceStyles is full page and genes11_references is full page

the word will more one line

test.docx (12.0 KB)

@zongsan You can use following code:

ReportingEngine engine = new ReportingEngine() { Options = ReportBuildOptions.RemoveEmptyParagraphs };

You can check another build options here: ReportBuildOptions Enum | Aspose.Words for .NET

I have set it up like this, but it still doesn’t take effect.

@zongsan Could you provide the document you are trying to insert that can help us reproduce the problem?

@zongsan

I think, the issue is that several options should be combined in one ReportingEngine.setOptions call like this:

this.engine.setOptions(ReportBuildOptions.REMOVE_EMPTY_PARAGRAPHS | ReportBuildOptions.ALLOW_MISSING_MEMBERS);

After my tests, I found that this method has the same problem. The previous configuration takes effect (ReportBuildOptions.REMOVE_EMPTY_PARAGRAPHS), while the subsequent configuration does not take effect (ReportBuildOptions.ALLOW_MISSING_MEMBERS).

this.engine.setOptions(ReportBuildOptions.REMOVE_EMPTY_PARAGRAPHS + ReportBuildOptions.ALLOW_MISSING_MEMBERS);  ) 

maybe this is right

@zongsan Could you try to use:

engine.setOptions(ReportBuildOptions.fromNames(Set.of(
            "REMOVE_EMPTY_PARAGRAPHS",
            "ALLOW_MISSING_MEMBERS"
        )));

But the previous code:

this.engine.setOptions(ReportBuildOptions.REMOVE_EMPTY_PARAGRAPHS | ReportBuildOptions.ALLOW_MISSING_MEMBERS);

also should work.

Also you can check descriptions for options here ReportBuildOptions | Aspose.Words for Java. Maybe you’re expecting something from these options that they can’t do?