Browse Source

WpfExporter

reports
Peter Forstmeier 12 years ago
parent
commit
95fdb380c1
  1. 33
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/ExportRenderer/FixedDocumentCreator.cs
  2. 9
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Globals/MeasurementService.cs
  3. 2
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/DataPageBuilder.cs

33
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/ExportRenderer/FixedDocumentCreator.cs

@ -40,8 +40,6 @@ namespace ICSharpCode.Reporting.ExportRenderer @@ -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 @@ -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 @@ -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);

9
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Globals/MeasurementService.cs

@ -15,7 +15,7 @@ namespace ICSharpCode.Reporting.Globals @@ -15,7 +15,7 @@ namespace ICSharpCode.Reporting.Globals
/// <summary>
/// Description of MeasurementService.
/// </summary>
internal static class MeasurementService
static class MeasurementService
{
@ -26,16 +26,15 @@ namespace ICSharpCode.Reporting.Globals @@ -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;
}
}

2
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/DataPageBuilder.cs

@ -85,7 +85,7 @@ namespace ICSharpCode.Reporting.PageBuilder @@ -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);

Loading…
Cancel
Save