Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Wed Jul 29, 2020 12:55 pm

Hi,
we are currently experiencing an issue in merging two documents.

Background: we have document templates with the stationery (with logos, header & footer). We receive in input a word document and we apply the template by merging this document in the template.

Issue: the pasted document is loosing all the line spacing/paragraph styling. Looking at the merged document I also note in the styles bar a new style named "Normal_GUID" where GUID is a 36 char GUID code.

I'm currently using this code

foreach (Section sec in docContent.Sections)
{
foreach (DocumentObject obj in sec.Body.ChildObjects)
{
docTemplate.LastSection.Body.ChildObjects.Add(obj.Clone());
}
}

I've replaced this code with (fileformat is "docx")

MemoryStream ms = new MemoryStream();
docContent.SaveToStream(ms, FileFormat(inputFormat));
docTemplate.InsertTextFromStream(ms, FileFormat(inputFormat));

Using this code the formatting of the pasted content is fully preserved but:
- I have a first empty page
- the footer of the first page (template sets a footer only in the first page) has the formatting damaged with extra line spacing.
- the is no "Normal_GUID" Style in the Style bar (which is good)

What's really strange is that if in the method

MemoryStream ms = new MemoryStream();
docTemplate.SaveToStream(ms, FileFormat(outputFormat));

i use "pdf" as output format and not "docx" everything is ok. With "doc" or "rtf" output format I have the same issue
So, this looks like something wrong in the SaveToStream

Any Hints?
Thanks!

WileECoyote
 
Posts: 2
Joined: Fri Aug 30, 2013 2:38 am

Thu Jul 30, 2020 8:20 am

Hello,

Thanks for your inquiry.
To help us investigate your issue more accurately and quickly, please provide your input files, your output files as well as the output you expect. You can upload them here or send them to us(support@e-iceblue.com) via email. Thanks in advance.

Sincerely
Elena
E-iceblue support team
User avatar

Elena.Zhang
 
Posts: 279
Joined: Thu Jul 23, 2020 1:18 am

Fri Aug 07, 2020 8:55 am

Hi,

Greetings from E-iceblue.
How is your issue now? Could you please give us some feedback at your convenience?

Sincerely
Elena
E-iceblue support team
User avatar

Elena.Zhang
 
Posts: 279
Joined: Thu Jul 23, 2020 1:18 am

Return to Spire.Doc

cron