Skip to content

Commit

Permalink
Fix MinColWidth property setting
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergiy Korzh committed Dec 6, 2023
1 parent 788508b commit 7b7d073
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,10 @@ public async Task ExportAsync(IEasyDataResultSet data, Stream stream, IDataExpor
var ignoredCols = GetIgnoredColumns(data, settings);

var pageSizes = GetPageSizes(pdfSettings.PageFormat);
var pageWidth = pdfSettings.Orientation == Orientation.Landscape
? pageSizes.Height
: pageSizes.Width;
if (pdfSettings.Orientation == Orientation.Landscape) {
(pageSizes.Width, pageSizes.Height) = (pageSizes.Height, pageSizes.Width);
}
var pageWidth = pageSizes.Width;

//calculating the width of one column
var colCount = data.Cols.Count - ignoredCols.Count;
Expand All @@ -115,6 +116,10 @@ public async Task ExportAsync(IEasyDataResultSet data, Stream stream, IDataExpor

if (pdfSettings.MinColWidth > 0 && colWidth < pdfSettings.MinColWidth) {
colWidth = pdfSettings.MinColWidth;
section.PageSetup.PageFormat = PageFormat.A0;
pageWidth = colWidth * colCount + pdfSettings.Margins.Left + pdfSettings.Margins.Right;
section.PageSetup.PageWidth = Unit.FromMillimeter(pageWidth);
section.PageSetup.PageHeight = Unit.FromMillimeter(pageSizes.Height);
}

if (settings.ShowDatasetInfo) {
Expand Down

0 comments on commit 7b7d073

Please sign in to comment.