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 Sep 07, 2018 7:33 pm

Hi all,

I'm having a problem where when I do a text replacement with extended characters in a loaded document template and then save the result as both Word (DOCX) and PDF, the Word document shows the extended character replacement, but the PDF version doesn't. The PDF does show normal replacement text however. See the attached template and the resulting Word and PDF files.

Here's my code:

Code: Select all
using Spire.Doc;
using Spire.Doc.Interface;

namespace TemplateTester
{
    internal class Program
    {
        private static readonly string checkMark = ((char)0x2611).ToString();
        private static readonly string emptyMark = ((char)0x2610).ToString();

        private static void Main()
        {
            var document = new Document("test.dotx", FileFormat.Dotx);

            ReplaceMetaTag(document, "[Checked]", true);
            ReplaceMetaTag(document, "[Unchecked]", false);
            document.Replace("[Text]", "Replacement Text Test", false, true);
            document.SaveToFile("test.docx", FileFormat.Docx);
            document.SaveToFile("test.pdf", FileFormat.PDF);
        }

        private static void ReplaceMetaTag(IDocument document, string tag, bool value)
        {
            document.Replace(tag, value ? checkMark : emptyMark, false, true);
        }
    }
}

jhanford
 
Posts: 6
Joined: Mon May 01, 2017 11:19 pm

Fri Sep 07, 2018 7:34 pm

I should say that I'm using the version 6.3 Free Edition, but I tried the 6.8.16 hot fix and it still didn't work.

jhanford
 
Posts: 6
Joined: Mon May 01, 2017 11:19 pm

Mon Sep 10, 2018 9:20 am

Hello,

Thanks for your inquiry and sorry for late reply as weekend.
I have noticed the issue and forwarded it to our Dev team for analyzing and fixing. If it is fixed or there is any update, we will let you know. Sorry for the inconvenience caused.

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1187
Joined: Tue Sep 27, 2016 1:06 am

Return to Spire.Doc