All logic and prior posts tell me this code should work, but I’ve spent the last 2 days trying and it doesn’t. Please help.
I’m opening an existing Word document with nothing but a header and footer and I need to write the contents of a datatable to the document. Everything works, except it does not respond to the formatting commands I’m sending – font changes and indenting.
I’m using the evaluation copy. Here is a snippet of my code.
Dim doc As Document = New Document(gAppPath + “\mydoc.doc”)
Dim docbuild As New DocumentBuilder(doc)
strFile = “textfl” & gUserID & “.doc”
docbuild.ParagraphFormat.ClearFormatting()
docbuild.Font.Size = 8
docbuild.Font.Name = “Arial”
Dim mcounter As Integer
For mcounter = 0 To max - 1
If InStr(“6,7,8,9”, Trim(dtPrint.Rows(mcounter).Item(“Number”).ToString)) > 0 Then
It’s not working. I went so far as to alter your DocumentBuilderdemo. I worked on the section that prints "This fragment demonstrates use of paragraph formatting to specify…"
I commented out the paragraphcenter line, rebuilt the project and ran the demo. It does not indent. Try it.
Please make sure that you use the latest version of Aspose.Word. I have done exactly as you describe and it works just perfectly. Paragraph containing “This fragment demonstrates use of paragraph formatting…” is still indented 2 inches from the left.
Everything is up to date. I had someone else try it and she received the same results I did. When I save it as a Word document the formatting is removed. When I save it as a PDF, it works.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.