I'm creating a WPF application and I want print a word document using spire.doc. I read some tutorials and they say that I should use this code.
//Create Word document.
Document document = new Document();
document.LoadFromFile(@"..\..\..\..\..\..\Data\Template.docx");
//Print doc file.
System.Windows.Forms.PrintDialog dialog = new System.Windows.Forms.PrintDialog();
dialog.AllowCurrentPage = true;
dialog.AllowSomePages = true;
dialog.UseEXDialog = true;
try
{
document.PrintDialog = dialog;
dialog.Document = document.PrintDocument;
dialog.Document.Print();
}
But it doesn't work because document.PrintDialog
type is System.Windows.Controls.PrintDialog
and I get this error:
cannot implicitly convert type 'System.Windows.Forms.PrintDialog' to 'System.Windows.Controls.PrintDialog'