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.

Fri May 06, 2022 12:33 am

Hi
Please look wrong formatting between doc file and pdf
https://bit.ly/3FzRPnH - pdf (wrong formatting)
https://bit.ly/37nuc50 - doc


private void button30_Click(object sender, EventArgs e)
{

Document doc = new Document("D:\\APCheckTemplate.doc");

string[] fieldNames = doc.MailMerge.GetMergeFieldNames().Distinct().ToArray();
string[] fieldValues = (string[])fieldNames.Clone();

doc.MailMerge.MergeField += MailMerge_MergeField;
doc.MailMerge.Execute(fieldNames, fieldValues);

doc.SaveToFile("D:\\result.pdf", new ToPdfParameterList() { IsEmbeddedAllFonts = true });
doc.SaveToFile("D:\\result.docx", FileFormat.Docx);
}

private void MailMerge_MergeField(object sender, MergeFieldEventArgs args)
{
if (args.FieldValue != null && args.FieldValue.ToString().ToLower() == "ap_CheckPayeeNameAddress".ToLower()) args.Text = "This Guy Rentals\r\n2218 East Williams field Rd Suite 240\r\nGilbert, AZ 85226";
}

sserra
 
Posts: 76
Joined: Tue Jun 13, 2017 4:03 pm

Fri May 06, 2022 1:59 am

Hello,

Thanks for your inquiry.
To assist us in investigate this issue, could you please send the doc file to us via email(support@e-iceblue.com)? Thanks in advance.
Sincerely,
Andy
E-iceblue support team
User avatar

Andy.Zhou
 
Posts: 483
Joined: Mon Mar 29, 2021 3:03 am

Fri May 06, 2022 1:22 pm

sent

sserra
 
Posts: 76
Joined: Tue Jun 13, 2017 4:03 pm

Sat May 07, 2022 5:13 am

Hello,

Thank you for sharing your testing file.
I tested your code with our latest Spire.Office Platinum(Hotfix) Version:7.4.10, but I didn’t reproduce the formatting issue. I provided my testing results via email. If you were using an old version, I suggest that you use the latest one to try again, if your issue still exists after trying, to help further look into it, please share us with the following more information.
1. The target platform of your project(E.g. .NET framework 7.0).
2. Your system information (E.g. Win7, 64 bit) and region setting (E.g. China, Chinese).
3. Your output PDF file.

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1261
Joined: Wed Apr 25, 2018 3:20 am

Return to Spire.Doc