Hello,
I´m trying to print an Excel worksheet with C#. I can load
the
worksheet
and save it to disk fine, but, when I try to print that
worksheet,
using WorkSheet.PrintOut Method,
it always gives me a COM Exception telling me that the
operation
finished with HRESULT:0x800401A8. Here is the
code:
this.printDialog.PrinterSettings = new
System.Drawing.Printing.PrinterSettings();
DialogResult result = this.printDialog.ShowDialog();
if (result == DialogResult.OK)
{
m_WorkSheet.PrintOut(Type.Missing, Type.Missing, 1,
false,
this.printDialog.PrinterSettings.PrinterName,false, false,
Type.Missing);
}
What I´m doing wrong?
Also, I have tried the msdn example, (The only difference is
that the
example prints the document to a file, instead of sending it
to the
printer). with the same result.
Thanks in advance.
|