We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Doc not appearing correctly

Hi, I am loading a Word Document from the database into DocIO and it is not appearing as it should, eg I get footers placed at random places in the document and page 1 and 2 swapping around. Unfortunately, I cannot send you the document as it is confidential but from my point of view it looks very simple, no images or tables, just text. Here is the code I use Template template = Template.Load(templateId); WordDocument document = new WordDocument(); document.Open(new MemoryStream(template.Content, 0, template.ContentLength), FormatType.Doc); // Start Replace document.Replace("$MembershipId$", membershipId, true, true); document.Replace("$Date$", DateTime.Now.ToLongDateString(), true, true); document.Replace("$Address$", address.ToString(), true, true); document.Replace("$SubscriptionGrade$", member.SubscriptionGrade, true, true); document.Replace("$RenewalDate$", member.RenewalDate, true, true); document.Replace("$Name$", member.Title + " " + member.Surname, true, true); // End Replace document.Save("Template.doc", FormatType.Doc, context.Response, HttpContentDisposition.InBrowser);

2 Replies

AD Administrator Syncfusion Team July 3, 2006 01:16 PM UTC

The document.Replace() function also doesn''t work for all text


AD Administrator Syncfusion Team July 3, 2006 05:42 PM UTC

Hi David, Thanks for your interest with Essential DocIO. I have tried to load the template document from database and then I will do find and replace with the document contents including footer text. It seems working fine for me. Here is a sample for your reference. Sample : FR_FromDBDoc.zip Please let me know if it resolves your problem. If not could you send me your template document. I will try to reproduce the issue. Thanks, Prabhu. >Hi, > >I am loading a Word Document from the database into DocIO and it is not appearing as it should, eg I get footers placed at random places in the document and page 1 and 2 swapping around. > >Unfortunately, I cannot send you the document as it is confidential but from my point of view it looks very simple, no images or tables, just text. > >Here is the code I use > >Template template = Template.Load(templateId); > >WordDocument document = new WordDocument(); >document.Open(new MemoryStream(template.Content, 0, template.ContentLength), FormatType.Doc); >// Start Replace >document.Replace("$MembershipId$", membershipId, true, true); >document.Replace("$Date$", DateTime.Now.ToLongDateString(), true, true); >document.Replace("$Address$", address.ToString(), true, true); >document.Replace("$SubscriptionGrade$", member.SubscriptionGrade, true, true); >document.Replace("$RenewalDate$", member.RenewalDate, true, true); >document.Replace("$Name$", member.Title + " " + member.Surname, true, true); >// End Replace >document.Save("Template.doc", FormatType.Doc, context.Response, HttpContentDisposition.InBrowser);

Loader.
Live Chat Icon For mobile
Up arrow icon