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 Mar 18, 2015 6:16 pm
Hello,
I'm trying to evaluate Spire.
I can't seem to figure out printing.
All your examples are in C# and I have tried to convert to VB.
But the doc object doesn't have a PrintDialog property.
Dim doc As New Document()
doc.LoadFromFile("sample.doc")
Dim PrintDialog As New PrintDialog()
doc.PrintDialog = PrintDialog * this line fails *
Could you post a simple snippet for VB2008 NET 3.5?
Thank you
Peter Knowles
-
pknowles
-
- Posts: 18
- Joined: Wed Mar 18, 2015 3:51 pm
Thu Mar 19, 2015 7:36 am
Hello,
Thank you for your inquiry.
The PrintDialog is in the namespace System.Windows.Forms.
Please use the following code.This is a console application:
- Code: Select all
Imports Spire.Doc
Imports System.Collections.Generic
Imports System.Linq
Imports System.Text
Imports System.Windows.Forms
Imports System.Drawing.Printing
Module Module1
Sub Main()
Dim document As New Document()
document.LoadFromFile("sample.doc")
Dim dialog As New PrintDialog()
dialog.AllowCurrentPage = True
dialog.AllowSomePages = True
dialog.UseEXDialog = True
document.PrintDialog = dialog
dialog.Document = document.PrintDocument
document.PrintDocument.Print()
End Sub
End Module
-
sweety1
-
- Posts: 539
- Joined: Wed Mar 11, 2015 1:14 am
Thu Mar 19, 2015 12:37 pm
Hello,
Thanks for following up.
I still can't get it to work however.
I have no trouble calling the PrintDialog in VB.
The problem is that the Spire document object doesn't have the property "PrintDialog"
the expression - "document.PrintDialog = dialog" fails because PrintDialog isn't a member of document.
Thanks in advance
Peter
-
pknowles
-
- Posts: 18
- Joined: Wed Mar 18, 2015 3:51 pm
Thu Mar 19, 2015 1:16 pm
pknowles wrote:Hello,
Thanks for following up.
I still can't get it to work however.
I have no trouble calling the PrintDialog in VB.
The problem is that the Spire document object doesn't have the property "PrintDialog"
the expression - "document.PrintDialog = dialog" fails because PrintDialog isn't a member of document.
Thanks in advance
Peter
don't quote me on this, but it may be because you use the free version, which does not have that function.
-
Hampo
-
- Posts: 28
- Joined: Thu Jan 22, 2015 2:29 pm
Thu Mar 19, 2015 4:52 pm
Hampo,
Thanks for the heads up.
If you're right I'm afraid it's of no use to me for evaluation.
Printing is my primary need.
Perhaps someone from e-iceblue can clarify.
Peter
-
pknowles
-
- Posts: 18
- Joined: Wed Mar 18, 2015 3:51 pm
Fri Mar 20, 2015 3:30 am
Hello,
Please remember add the namespace system.Windows.forms and System.Drawing.Printing. In addition, please try a new version of Free Spire.Doc for .NET(Version_5.2). You can download it via link below:
http://www.e-iceblue.com/Download/download-word-for-net-now.htmlBest Regards,
Sweety
E-iceblue support team
-
sweety1
-
- Posts: 539
- Joined: Wed Mar 11, 2015 1:14 am
Sat Mar 21, 2015 3:12 am
I figured it out.
I only had the standard edition which I don't think supports printing.
Peter
-
pknowles
-
- Posts: 18
- Joined: Wed Mar 18, 2015 3:51 pm
Mon Mar 23, 2015 6:38 am
Hello,
You are right, standard edition doesn't support printing function.
Please feel free to contact us, if you have any questions or needs. We are here for help.
Best Regards,
Sweety
E-iceblue support team
-
sweety1
-
- Posts: 539
- Joined: Wed Mar 11, 2015 1:14 am