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.

Wed Aug 19, 2015 7:07 am

Hi Guys,

I am asked to write a project to make an automation tool to fill some blanks in a word file. This file will be generated by other team members, the file would be a contract. In the contract, there will be some blanks leave for filling, eg: This contract will be effected from ______ to ______, in the two blanks, I will need to fill 2 dates into it.

This project will be made as a winform project and I will fill some values in the winform tool, after click the button, I will open the template doc file and then fulfill all the blanks automatically and then save the file as a pdf.

Could any one provide some solutions to this functionality of operating the doc files. I will have to search to the blank key words and input some value into the target blank.

Thanks very much!

hachi1030
 
Posts: 5
Joined: Wed Aug 19, 2015 1:58 am

Wed Aug 19, 2015 9:32 am

Hello,

Thanks for your inquiry.
If the blank position only has a horizontal line in the word file, sorry that our product Spire.Doc does not supporte the feature you mentioned at this stage.

Best Regards,
Sweety

E-iceblue support team
User avatar

sweety1
 
Posts: 539
Joined: Wed Mar 11, 2015 1:14 am

Wed Aug 19, 2015 9:39 am

sweety1 wrote:Hello,

Thanks for your inquiry.
If the blank position only has a horizontal line in the word file, sorry that our product Spire.Doc does not supporte the feature you mentioned at this stage.

Best Regards,
Sweety

E-iceblue support team


Then what situation can I do the target with the blank? What do you mean by the horizontal line? Where should I put the blank so that I can operate it?

hachi1030
 
Posts: 5
Joined: Wed Aug 19, 2015 1:58 am

Thu Aug 20, 2015 7:39 am

Hello,

Thanks for your reply.
1. There is a situation.
You know the exact position ( horizontal and vertical coordinates ) of the blank.
Then you can append text by adding textBox in the blank position.
And here is the code for your reference.
Code: Select all
    Document doc = new Document();
            Section sec = doc.AddSection();
            Paragraph par = sec.AddParagraph();
            Spire.Doc.Fields.TextBox textBox = par.AppendTextBox(80, 20);
            Paragraph par1 = textBox.Body.AddParagraph();
            par1.AppendText("Hello, world");
            textBox.Format.TextWrappingStyle = TextWrappingStyle.InFrontOfText;
            textBox.Format.VerticalOrigin = VerticalOrigin.Margin;
            textBox.Format.VerticalPosition = 200;
            textBox.Format.HorizontalOrigin = HorizontalOrigin.Margin;
            textBox.Format.HorizontalPosition = 100;
            textBox.Format.LineColor = Color.White;
            doc.SaveToFile("result.docx", FileFormat.Docx);

2. The horizontal line means this short line(e.g. from ______ to ______, ) in your example.
3. If the blank is in a FormField, then you also can operate it.
There is a tutorial in our website.
http://www.e-iceblue.com/Tutorials/Spire.Doc/Spire.Doc-Program-Guide/Fill-Form-Fields-in-Word-Document-in-C.html

Best Regards,
Sweety

E-iceblue support team
User avatar

sweety1
 
Posts: 539
Joined: Wed Mar 11, 2015 1:14 am

Tue Aug 25, 2015 8:45 am

Hello,

Has your issue been resolved?
Thanks for your feedback.

Best Regards,
Sweety

E-iceblue support team
User avatar

sweety1
 
Posts: 539
Joined: Wed Mar 11, 2015 1:14 am

Return to Spire.Doc