I’m experiencing some problems with the layout after loading a Word document into Aspose.Words (Java), editing it and saving it back to PDF. My source document basically consists of just two bookmarks which are placed right after one another in separate paragraphs. Now when I read the document with Aspose and add a list (ol or ul) into the first bookmark (via insertHtml) the resulting PDF shows an unexpected large space between the list and the next paragraph (see Result_List.pdf). This large space is not there when I just add text into the first bookmark (see Result.pdf). Where does this space (seems to be one “additional” empty line) come from? Is this expected behavior for lists?
thanks for your quick response. Much appreciated!
Yet I’m still a bit puzzled as to where this empty paragraph comes from since it is not in my source document (Source.docx). I also don’t add it in my code since the only two things I’m actually doing is inserting some html for bookmark 1 and some for bookmark 2 (Code_sample.txt).
I’d gladly remove the empty paragraph (before writing the output) if I’d know where it is (or where it comes from). Any advice?
is entry 1
- This is entry 2
thanks again for your answer. I see what you mean and understand why the paragraph is there. If I don’t set the bookmarks text to an empty string I can see the paragraph with the bookmarks text (“Test1”) right after my inserted list.
Let me just rephrase my question one last time. Is it possible to use my Source.docx to get an output like in DesiredResult.docx by using insertHtml? I’m basically looking for some functionality to replace the two bookmarks (or their contents) with custom HTML (the first with a list, the other with some text). Is this possible?
Thanks for your time,
Document doc = new
Document(MyDir + “source.docx”);<o:p></o:p>
DocumentBuilder builder = new DocumentBuilder(doc);
builder.write("This is another paragraph");
doc.save(MyDir + "Out.docx");