diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/ExportRenderer/FixedDocumentCreator.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/ExportRenderer/FixedDocumentCreator.cs index bfe088cf60..c9703d09d0 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/ExportRenderer/FixedDocumentCreator.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/ExportRenderer/FixedDocumentCreator.cs @@ -40,8 +40,6 @@ namespace ICSharpCode.Reporting.ExportRenderer var fixedPage = new FixedPage(); fixedPage.Width = exportPage.Size.ToWpf().Width; fixedPage.Height = exportPage.Size.ToWpf().Height; - -// fixedPage.Background = ConvertBrush(System.Drawing.Color.Blue); fixedPage.Background = new SolidColorBrush(System.Drawing.Color.Blue.ToWpf()); return fixedPage; } @@ -49,7 +47,6 @@ namespace ICSharpCode.Reporting.ExportRenderer public Canvas CreateContainer(ExportContainer container) { var canvas = CreateCanvas(container); - Console.WriteLine("WPF Create Container with {0}",container.DesiredSize); var size = container.DesiredSize.ToWpf(); canvas.Measure(size); canvas.Arrange(new Rect(new Point(),size )); @@ -104,25 +101,25 @@ namespace ICSharpCode.Reporting.ExportRenderer } static Size MeasureTextInWpf(ExportText exportText){ + if (exportText.CanGrow) { + var formattedText = new FormattedText(exportText.Text, + CultureInfo.CurrentCulture, + FlowDirection.LeftToRight, + new Typeface(exportText.Font.FontFamily.Name), + exportText.Font.Size, + new SolidColorBrush(exportText.ForeColor.ToWpf()), + null, + TextFormattingMode.Display); - FormattedText ft = new FormattedText(exportText.Text, - CultureInfo.CurrentCulture, - System.Windows.FlowDirection.LeftToRight, - new Typeface(exportText.Font.FontFamily.Name), - exportText.Font.Size, - new SolidColorBrush(exportText.ForeColor.ToWpf()), - null, - TextFormattingMode.Display); - - ft.MaxTextWidth = exportText.Size.Width * 96.0 / 72.0; - ft.MaxTextHeight = Double.MaxValue ; + formattedText.MaxTextWidth = exportText.DesiredSize.Width * 96.0 / 72.0; +// ft.MaxTextHeight = exportText.DesiredSize.Height + 5 * 96.0 / 72.0; +// ft.MaxTextHeight = Double.MaxValue ; - ft.SetFontSize(exportText.Font.Size * 96.0 / 72.0); -// ft.SetFontSize(exportText.Font.Size); + formattedText.SetFontSize(exportText.Font.Size * 96.0 / 72.0); var size = new Size { - Width = ft.WidthIncludingTrailingWhitespace, - Height = ft.Height}; + Width = formattedText.WidthIncludingTrailingWhitespace, + Height = formattedText.Height + 6}; return size; } return new Size(exportText.Size.Width,exportText.Size.Height); diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Globals/MeasurementService.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Globals/MeasurementService.cs index ada9c55200..f90c0930ed 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Globals/MeasurementService.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Globals/MeasurementService.cs @@ -15,7 +15,7 @@ namespace ICSharpCode.Reporting.Globals /// /// Description of MeasurementService. /// - internal static class MeasurementService + static class MeasurementService { @@ -26,16 +26,15 @@ namespace ICSharpCode.Reporting.Globals var sf = new StringFormat(); sf.FormatFlags = StringFormatFlags.MeasureTrailingSpaces; if (!String.IsNullOrEmpty(item.Text)) { - SizeF size = graphics.MeasureString(item.Text.TrimEnd(), + SizeF sizeF = graphics.MeasureString(item.Text.TrimEnd(), item.Font, item.Size.Width); - if (size.Height < item.Size.Height) { + if (sizeF.Height < item.Size.Height) { return item.Size; } - return new Size(item.Size.Width,(int)Math.Ceiling(size.Height)); + return new Size(item.Size.Width,(int)Math.Ceiling(sizeF.Height)); } - return item.Size; } } diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/DataPageBuilder.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/DataPageBuilder.cs index 4d761bf3af..58eb8ccd14 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/DataPageBuilder.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/DataPageBuilder.cs @@ -85,7 +85,7 @@ namespace ICSharpCode.Reporting.PageBuilder converter.SetParent(sectionContainer, headerItems); headerRow.ExportedItems.AddRange(headerItems); - + headerRow.Parent = sectionContainer; sectionContainer.ExportedItems.Add(headerRow); EvaluateExpressionsInGroups(sectionContainer,grouping);