Print of DataGridView on worksheet is always blank

M

Mark

Hello all -

I'm working using VSTO to create an excel 2007 application. I'm using C# as
the programming language.

Background:
I've dragged a DataGridView control onto a worksheet and the DataGridView is
bound to a data table. The data in the data table and hence the
DataGridView's content changes when an SQL select statment is executed.

I've a do-loop that executes the SQL statement and then prints the worksheet
that contains the DataGridView. The C# print statement looks like:

Globals.Sheet1.PrintOutEx(1, 1, 1, missing, missing, missing, missing,
missing, missing);

Problem:

The contents in the DataGridView doesn't show up on the printed page. It's
black or sometimes it has the column headings with no data. It's like
whatever the contents of the first SQL select statement is there on the first
execution is what it prints for each iteration.

The DataGridview doesn't update.

Executing the SQL select and printing manually (i.e., Office Button -> Print
-> Print), the contents show up just fine.

Is there something special about printing an embeded control?

Any ideas are always appreciated.

Thanks,

Mark
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top