This commit is contained in:
@@ -1533,6 +1533,39 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int TotalColWidths()
|
||||
{
|
||||
int cwid = 0;
|
||||
foreach (Column c in Cols)
|
||||
{
|
||||
cwid += ((c.Width > 0) ? c.Width : Cols.DefaultSize);
|
||||
}
|
||||
return cwid;
|
||||
}
|
||||
/// <summary>
|
||||
/// This will adjust the column widths of the current table based upon the page width
|
||||
/// Note: This is for use in creating a new table - not to process an existing table.
|
||||
/// </summary>
|
||||
/// <param name="pgWidthPoints"></param>
|
||||
public void FitTableToPageWidth(int pgWidthPoints)
|
||||
{
|
||||
int grdWidth = TotalColWidths();
|
||||
int pgwidth = (int)((pgWidthPoints / 72) * this._DPI);
|
||||
|
||||
if (grdWidth > pgwidth)
|
||||
{
|
||||
int difWid = grdWidth - pgwidth;
|
||||
int colAdj = (difWid / Cols.Count) +(((difWid % Cols.Count) > 0) ? 1 : 0);
|
||||
foreach (Column c in Cols)
|
||||
{
|
||||
int cwid = (c.Width > 0) ? c.Width : Cols.DefaultSize;
|
||||
if ((cwid - colAdj) > 0)
|
||||
c.Width = cwid - colAdj;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//private void AdjustCellHeightWidth(int r, int c)
|
||||
//{
|
||||
// StepRTB trtb = new StepRTB();
|
||||
|
Reference in New Issue
Block a user