You are not logged in.
This forum has been archived and no longer accepts new user registrations. Please report your questions, problems, and feedback to the issue page of ReoGrid on GitHub. Thank you for your cooperation.
Pages: 1
Topic closed
Hello Jing,
I have question can you print a sheet that completely created by code? i will have print preview but i also just want have print button and print it. Also, can i use the pagesetup dialog to set the page setting?
Shane
Offline
Hi Shane,
Did you check the sample file in demo project - PrintPreviewDemo.cs, sorry that was written in C# but it should work in VB.NET.
And document available in here:
http://reogrid.net/document/paging-and-print/
If you have any questions please let me know.
Jing
Offline
Hello Jing,
I looked that paging and printing before i send you the message.. I did see the example in demo application, I see that you can use the .net printing.
What i was asking, can i make a control in code only and setup the whole spreed sheet in code and then print off without not evening seeing it? that is what i was asking..
Maybe, I will make temple files and then load them into as sheets then add the data via code.. save me lot of coding the sheet by handed..
dim WithEvents rgPrintGrid As ReoGridControl
dim WithEvents rgPrintSheet As Worksheet
rgPrintSheet = rgPrintGrid.CurrentWorksheet
'Code to create the sheet and send to printer
Shane
Last edited by asparatu (2015-06-11 01:26:51)
Offline
This is the code, simplest way to print document without GUI.
VB.NET
sheet = grid.CurrentWorksheet
Dim printDoc = sheet.CreatePrintDocument()
printDoc.Print()
The method CreatePrintDocument returns a standard .NET printable document, you could refer to here for printing in .NET:
https://msdn.microsoft.com/en-us/librar … .110).aspx
Jing
Offline
Hello Jing,
Its not the print GUI, It is the GUI of the control that will not be visible.. that is what i am talking about.
Shane
Offline
Your question was about how to add a print button on preview dialog?
Sorry I was confused. In the demo project ReoGrid uses a standard .NET preview dialog.
I think there is no way to add button or other GUI elements on standard .NET preview dialog, but .NET provides the preview control:
https://msdn.microsoft.com/en-us/librar … 10%29.aspx
You might be necessary to create your own preview dialog and put this control inside your form, or you could search on Internet for existing solutions, like this:
http://www.codeproject.com/Articles/387 … viewDialog
Edit: I just confirmed the preview dialog in demo project, standard .NET preview dialog also provide the print button.
I read your question again, I guess you maybe want to ask how to make three buttons in your own form, preview, page settings and another new one, print.
In this case, you could use the code above I provided, when print button clicked, printing the document without GUI would be fine.
1. Code behind of PreviewButton_Click
Please see the code in demo project.
2. Code behind of PageSettingButton_Click
Please see the code in demo project.
3. Code behind of PrintButton_Click
Dim printDoc = sheet.CreatePrintDocument()
printDoc.Print()
Jing
Last edited by Jingwood (2015-06-11 03:02:31)
Offline
Hello Jing,
Ok.. I understand what you are saying about using the with the GUI and no GUI with PrintDocument. That is not issue i have. I want to make sheet only as code, there will be no visible input for the Reogrid Sheet. I understand, i can sheet.CreatePrintDocument() to create a PrintDocument. Let me say this another way.. I just want the ReoGrid as object only. Normally, you would put the control on the form, but i want the control to just be an object and not be put on the form.. kind of like when i do this..
private withevents tb as textbox
That is only use in code an there is no visible control on the form that acts like textbox because it is textbox but only as object.
Hope you can understand what i am talking about now.. I did not explain myself better..
Shane
Offline
Maybe your answer is this?
Private withevents grid as ReoGridControl
Offline
Hello Jing,
thank you.
Shane
Offline
Pages: 1
Topic closed