hi
How to make a table of DataGridView information printed right to left?
[EDIT - OP code from comment]
private bool SetupThePrinting()
{
PrintDialog MyPrintDialog = new PrintDialog();
MyPrintDialog.AllowCurrentPage = false;
MyPrintDialog.AllowPrintToFile = false;
MyPrintDialog.AllowSelection = false;
MyPrintDialog.AllowSomePages = false;
MyPrintDialog.PrintToFile = false;
MyPrintDialog.ShowHelp = false;
MyPrintDialog.ShowNetwork = false;
if (MyPrintDialog.ShowDialog() != DialogResult.OK)
return false;
MyPrintDocument.DocumentName = "Customers Report";
MyPrintDocument.PrinterSettings =
MyPrintDialog.PrinterSettings;
MyPrintDocument.DefaultPageSettings =
MyPrintDialog.PrinterSettings.DefaultPageSettings;
MyPrintDocument.DefaultPageSettings.Margins =
new Margins(40, 40, 40, 40);
if (MessageBox.Show("Do you want the report to be centered on the page",
"InvoiceManager - Center on Page", MessageBoxButtons.YesNo,
MessageBoxIcon.Question) == DialogResult.Yes)
MyDataGridViewPrinter = new DataGridViewPrinter(MyDataGridView, MyPrintDocument, true, true, "Customers", new Font("Tahoma", 18, FontStyle.Bold, GraphicsUnit.Point), Color.Black, true);
else
MyDataGridViewPrinter = new DataGridViewPrinter(MyDataGridView, MyPrintDocument, false, true, "Customers", new Font("Tahoma", 18, FontStyle.Bold, GraphicsUnit.Point), Color.Black, true);
return true;
private void btnPrint_Click(object sender, EventArgs e)
{
if (SetupThePrinting())
MyPrintDocument.Print();
}
using System;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Printing;
using System.Data;
using System.Windows.Forms;
class DataGridViewPrinter
{
private DataGridView TheDataGridView;
private PrintDocument ThePrintDocument;
private bool IsCenterOnPage;
private bool IsWithTitle;
private string TheTitleText;
private Font TheTitleFont;
private Color TheTitleColor;
private bool IsWithPaging;
static int CurrentRow;
static int PageNumber;
private int PageWidth;
private int PageHeight;
private int LeftMargin;
private int TopMargin;
private int RightMargin;
private int BottomMargin;
private float CurrentY;
private float RowHeaderHeight;
private List RowsHeight;
private List ColumnsWidth;
private float TheDataGridViewWidth;
public DataGridViewPrinter(DataGridView aDataGridView, PrintDocument aPrintDocument,
bool CenterOnPage, bool WithTitle, string aTitleText, Font aTitleFont,
Color aTitleColor, bool WithPaging)
DataGridView MyDataGridView;
PrintDocument MyPrintDocument;
DataGridViewPrinter MyDataGridViewPrinter;