I wanna edit the follwing Word Document and save it as a PDF. See the x's? those are the places i wanna insert information from my C# app. Observations, Actions taken and Recommendations can be 1-many lines. I want those line to be in a specific format (font, font size and bolded). Finally i wanna put ticks in the selected check boxes at the end of the page. How can i do that? Thanks!
The modifications shouldn't be a problem, but saving it as a PDF is. Open XML is designed to read and modify the document, but it does nothing to display, print, or export the document since it contains nothing that will format the document for display, printing, etc. You might be able to use Word Automation Services to create a PDF if you have a "PDF printer."
As for the modifications, make one at a time to a copy and use Open XML SDK 2.0 Productivity tool to compare the original and the modified versions to see what has changed. It may help to simplify both documents before comparing them. There is a simplifier tool in PowerTools for Open XML. It is possible that your checkboxes will turn out to be using a block of binary data to keep their check/unchecked status. I don't know what to do in that case, so hope that it isn't doing that.
Hi aroshlakshan,
I have created a sample solution, which has a pre-define template that looks like,I have not included all the items. But the this covers all the items that you are looking for.Out put looks like,Have a look at the attached solution and let me know if you need any help.
Thanks a million pramodhegde!! Thank you very much! i'll try that!
I tried this and, in the observation area, i insert the lines by passing a string array to this,
List<string> dynamicList = new List<string>(ObservationsValues);
but the thing is i get 2 lines above and below the list items (apart from the existing lines). How can i get rid of it?
Hi,
The extra line is due to ParagraphBorder code.
ParagraphBorders paragraphBorders1 = new ParagraphBorders();
TopBorder topBorder1 = new TopBorder() { Val = BorderValues.Single, Color = "auto", Size = (UInt32Value)1U, Space = (UInt32Value)1U };
BottomBorder bottomBorder1 = new BottomBorder() { Val = BorderValues.Single, Color = "auto", Size = (UInt32Value)1U, Space = (UInt32Value)1U };
paragraphBorders1.Append(topBorder1);
paragraphBorders1.Append(bottomBorder1);
...
paragraphProperties1.Append(paragraphBorders1);
you can actually remove this code. Or you can comment this line
Thanks! i'll try that and let you know
How to change the font size of the lines after OBSERVATIONS?
I have attached my modified project here. But the thing is, the check boxes don't get checked. That happens in your original project too. Can you check this out and see what's missing??
I'll check and tell you.
Thanks
??????????
Only 3 things i gotta know here...
1. How to make it to type right in the next line after OBSERVATIONS
2. How to make the letters Unbold in the list under OBSERVATIONS.
3. How to make the check boxes work.
i need this code pramod please...!!
I have modified the code a bit and also the template file(dotx). Attached the solution. Please have a look. Let me know if you need any help.