Hi @Niteen_Jadhav
Sorry for the delay, it took some time to investigate all files and scenarious. Here are the results:
1. From the provided screenshot “editor view.PNG” I guess (but I may be wrong - if yes, please correct me) that you’re concerned about alignment of the first text block, right above the table, because it is stretched to the right side compared to the table below it. This is because you’ve converted DOCX document to the HTML in a float mode, where there are no strict page limits and boundaries. Like in pure HTML, content is adaptive and it fits into the viewport of any size. I’ve converted your “CMES KA GCOA Termsheet DocPro template.docx” file to the HTML float mode using GroupDocs.Editor and opened it in the browser in two instances: 1st one (attached file “Broad.png”) when my browser window is stretched among all display, and 2nd (attached file “Narrow.png”) when I manually narrowed windth of my browser window. As you can see, text content fits the viewport.
Broad.png (40.0 KB)
Narrow.png (47.5 KB)
If you want to achieve the same result as when you open the document in MS Word, please try to enable the pagination mode using the WordProcessingEditOptions
class and its EnablePagination
property set to true
or simply new WordProcessingEditOptions(true)
. More on that here.
2. I confirm that for the file “Automation-Termsheet-Docpro.docx” the “The document appears to be corrupted and cannot be loaded” exception is thrown during its backward conversion from the HTML to the DOCX format and this is a bug. We already started to work on it and will notify you when it will be fixed.
3. Unfortunately I cannot reproduce it. I’ve took the document “CMES KA GCOA Termsheet DocPro template.docx” and made its roundtrip - converted it to HTML (editing) and then reconverted it back to the DOCX (saving) using the next code:
string filename = "CMES KA GCOA Termsheet DocPro template.docx";
bool isPaged = true;
string inputPath = Path.Combine("some input folder", filename);
FileAssert.Exists(inputPath);
string outputPath = Path.Combine("some output folder", string.Format("{0}-{1}.docx", Path.GetFileNameWithoutExtension(filename), isPaged ? "paged" : "float"));
WordProcessingEditOptions editOpt = new WordProcessingEditOptions(isPaged);
WordProcessingSaveOptions saveOpt = new WordProcessingSaveOptions(WordProcessingFormats.Docx);
saveOpt.EnablePagination = isPaged;
using (Editor editor = new Editor(inputPath, new WordProcessingLoadOptions()))
{
using (EditableDocument edited = editor.Edit(editOpt))
{
string allEmbedded = edited.GetEmbeddedHtml();
using (EditableDocument saved = EditableDocument.FromMarkup(allEmbedded, null))
{
editor.Save(saved, outputPath, saveOpt);
}
}
}
The resultant file “CMES KA GCOA Termsheet DocPro template-paged.docx” I’m attaching to this post, you can see that there are no issues as you described. Maybe you’ve used some other editong and/or saving options for doing that?
CMES KA GCOA Termsheet DocPro template-paged.docx (2.8 MB)
Thanks and waiting for your reply.
With best regards,
Denis Gvardionov