How to properly create a Word or PDF document with values from DataBase

mite nikolov 1 Reputation point
2020-08-06T14:51:43.713+00:00

Hello,

I would like to ask for an advice. I have this model below that I need to create and fill it with some values from my DataBase.
What is the best way to accomplish this type of job? I've already tried to design the table directly on the form and print the form later, but sometimes the DataGridView is too long so my Form goes out of limits and it print only the parts that is seen on the Monitor.

An advice would be really appreciated..

Regards

16193-08062020untitled-1.jpg

Windows Forms
Windows Forms
A set of .NET Framework managed libraries for developing graphical user interfaces.
1,839 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Daniel Zhang-MSFT 9,621 Reputation points
    2020-08-12T02:34:15.32+00:00

    Hi mitenikolov,
    You can use Microsoft.Office.Interop.Word to put data in datagridview into word.
    First, you need to add Microsoft.Office.Interop.Word reference by following steps:
    Right click the project-> Manage NugetPackages->Browse-> Enter the "Microsoft.Office.Interop.Word" into the search box -> Install it.
    Here is a code example you can refer to.17103-test-2.txt
    Best Regards,
    Daniel Zhang

    0 comments No comments