 |
|
 |
Is it possible to extend the footer in 3 print areas like footer.left, footer.middle and footer.right ?
|
|
|
|
 |
|
 |
That's an excellent suggestion, but something that I'll have to think about ...
|
|
|
|
 |
|
 |
Hi ! Thank you very much for this class, it's been very useful for my project. I guess I may have found an exception in the code. When I try to print from a printer inside a network(no attachment to my computer), and when the connection is somehow not established, an exception is thrown. The exception is thrown at " printDoc.Print(); " line, and the message is "RPC server cannot be used" I am a newbie in C# but with a simple try-catch , I overcome the situation. I thought I should inform you in case you come with a better solution. I changed the code like this:
public void PrintNoDisplay(DataGridView dgv)
{
if (EnableLogging) Logger.LogInfoMsg("PrintNoDisplay process started");
if (null == dgv) throw new Exception("Null Parameter passed to DGVPrinter.");
if (!(dgv is DataGridView))
throw new Exception("Invalid Parameter passed to DGVPrinter.");
// save the grid we're printing
this.dgv = dgv;
printDoc.PrintPage += new PrintPageEventHandler(PrintPageEventHandler);
printDoc.BeginPrint += new PrintEventHandler(BeginPrintEventHandler);
try
{
// setup and do printing
SetupPrint();
printDoc.Print();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
///
/// Preview the provided grid view. Either DisplayPrintDialog() or it's equivalent
/// setup must be completed prior to calling this routine
///
///
|
|
|
|
 |
|
 |
Thanks for the suggestion! At this point in time, I think that showing message boxes is not proper behavior for an extension like DGVPRinter (error handling should be up to the calling program). However, trapping and re-throwing exceptions may be worth looking into.
Steve G.
|
|
|
|
 |
|
|
 |
|
 |
Hi Steve;
Firstly, congratulations on an outstanding piece of software. Truly Sound!
I wish to use a proprietary Print Dialog to preview the results (as opposed to the garbage MS Offering). Unless I missed something, there did not appear to be a simple way to create the PrintDocument object without actually printing it.
Consequently I cloned the two existing "Print" methods to RenderNoDisplay and RenderDataGridView and then simply removed the print command.
Perhaps this is something you might consider as an enhancement for the future.
Kind Regards
Dave
|
|
|
|
 |
|
 |
if one is blue like be blue. if one green want it to be green. how is this done
|
|
|
|
 |
|
 |
In you data grid view, set the cell style property 'BackColor' to the color you want and DGVPrinter will pick it up automatically.
Steve G.
|
|
|
|
 |
|
 |
Bug fixes galore!
This fixes a printing bug found by Member 8757586.
Enjoy!
Steve G.
|
|
|
|
 |
|
|
 |
|
 |
First of all, nice work.
But, on printing the DGV i get this exception:
float printpos = pagesets[currentpageset].margins.Top;
If i close my App, my printer works fine, but the last few rows won´t print.
I don´t know what i should do in this case.
Can you help me?
Regards,
Dom
|
|
|
|
 |
|
 |
That sounds odd. How are you calling DGVPrinter? I.e. can you email me the code you're using to call it, and also, can you turn logging on and send me a trace file?
Thanks!
Steve G.
|
|
|
|
 |
|
 |
Thanks for bringing this up - found and fixed!
Steve G.
|
|
|
|
 |
|
 |
Version 4.1 is now out - includes a bug fix thanks to B. Marik, a new logging/tracing facility and a greatly enhanced Embedded Print process.
Enjoy!
Steve G.
|
|
|
|
 |
|
 |
New version 4.1 fails to ArgumentOutOfRange exception:
Dim Pr As New DGVPrinter
With Pr
.PageNumberInHeader = True
.PrintHeader = True
.PrintRowHeaders = True
.ColumnWidth = DGVPrinter.ColumnWidthSetting.CellWidth
.PageSettings.Landscape = True
Dim SF As New Font("Arial", 10, FontStyle.Bold)
.PageSeparator = "/"
.TitleFont = SF
.FooterFont = SF
.TitleAlignment = StringAlignment.Near
.FooterAlignment = StringAlignment.Near
.PrintFooter = True
.Footer = My.Settings.OfficeName
.PrintDataGridView(DgView1)
End With
JB
|
|
|
|
 |
|
 |
Try to call .PrintDataGridView() method like aureolin shows it, using Me object.
.PrintDataGridView(Me.DgView1)
|
|
|
|
 |
|
 |
No affect. Note that preview works like charm.
With Pr
.PageNumberInHeader = True
.PrintHeader = True
.PrintRowHeaders = True
.ColumnWidth = DGVPrinter.ColumnWidthSetting.CellWidth
.PageSettings.Landscape = True
Dim SF As New Font("Arial", 10, FontStyle.Bold)
.PageSeparator = "/"
.TitleFont = SF
.FooterFont = SF
.TitleAlignment = StringAlignment.Near
.FooterAlignment = StringAlignment.Near
.PrintFooter = True
.Footer = My.Settings.OfficeName
.PrintPreviewDataGridView(Me.DgView1)
End With
|
|
|
|
 |
|
 |
Hi,
When i press the print-button the first time the printing is ok.
When I press a second time the print-button, then I receive the following message in the MessageBox:
Der Index lag außerhalb des Bereichs. Er muss nicht negativ und kleiner als die Auflistung sein.
Parametername: index
Below you see the click-eventhandler, which is calling the DGVPrinter.
private void btnPrint_Click(object sender, EventArgs e)
{
try
{
dgvPrinter.PrintDataGridView(dgvRightsList);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
This is the stack at the exception time:
bei System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
bei System.ThrowHelper.ThrowArgumentOutOfRangeException()
bei System.Collections.Generic.List`1.get_Item(Int32 index)
bei DGVPrinterHelper.DGVPrinter.Pagination()
bei DGVPrinterHelper.DGVPrinter.SetupPrint()
bei DGVPrinterHelper.DGVPrinter.PrintDataGridView(DataGridView dgv)
bei XXXXApp.frmChangeRightsList.btnPrint_Click(Object sender, EventArgs e) in C:\Users\xxxxx\Documents\Visual Studio 2005\Projects\xxxxx\xxxx\frmChangeRightsList.cs:Zeile 131.
Thanks in advance for your help.
eluelu
|
|
|
|
 |
|
 |
Yes, if you need to print a second grid (or the same grid for a second time), then you'll need a second DGVPrinter object. There's so much that goes into the prep for printing an individual grid that the object is not re-usable.
Hope this helps!
Steve G.
|
|
|
|
 |
|
 |
Hi, is it possible to print an image in only one page? For example the last page.
What I need to do is print along with the datagridview a MS chart control reprenting the information contained in the grid.
I have the chart already and I can convert it to an image. However all I could find is how to print it in every page, which works fine. Not in a particular page.
Thanks,
Sergio
|
|
|
|
 |
|
 |
Right now, this function is not directly supported. What it sounds like you want to do is modify the print processing to add a page at the end containing your chart. You can do this with DGVPrinter by using the 'Embedded Printing' process to generate images for each page and then add your chart at the end of the process.
Hope this helps!
Steve G.
|
|
|
|
 |
|
 |
Hi, it's me again. Is there a way to get the column headers to print even if there is no data in the data grid? As long as I have data in the grid, it prints beautifully. When there is no data, it throws an exception, which would be fine if I had only one grid to print. However, I am looping through about 50 of them using checkboxes. So I don't want an exception thrown. I want at least the column headers to print so the user knows that they don't have any data in the grid.
Barb
|
|
|
|
 |
|
 |
Hmmm ... Let me take a look at that.
Steve G.
|
|
|
|
 |
|
 |
I've forwarded to you an update of Beta 4.1 that fixes this problem. Please let me know how your testing goes, I'm just about ready to release this version.
Thanks,
Steve G.
|
|
|
|
 |
|
 |
I am unable to get my dgv to print with more then 1 part, ie. when the table is wider then the page it puts the rest on the other page. Also, no matter what flags I set for columnwidth or cellformatflags, either the cell data won't print on one line in the cell (it wraps), or data is just cut off (clips).
|
|
|
|
 |