From e50031284c36499d1dd37b1953673bcee19ab60f Mon Sep 17 00:00:00 2001 From: Peter Forstmeier Date: Thu, 22 Aug 2013 20:34:13 +0200 Subject: [PATCH] use only DataItems in DataManager/Listhandling/CollectionSource.cs --- .../Src/Arrange/MeasurementStrategy.cs | 4 +-- .../Listhandling/CollectionSource.cs | 7 +++-- .../ExportRenderer/FixedDocumentCreator.cs | 26 ++++++++++--------- .../Converter/ContainerConverter.cs | 3 +-- 4 files changed, 22 insertions(+), 18 deletions(-) diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Arrange/MeasurementStrategy.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Arrange/MeasurementStrategy.cs index e29454f737..a5f45f3465 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Arrange/MeasurementStrategy.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Arrange/MeasurementStrategy.cs @@ -35,9 +35,9 @@ namespace ICSharpCode.Reporting.Arrange if (tbi != null) { element.DesiredSize = MeasurementService.Measure(tbi,graphics); } + Console.WriteLine("Measure -> {0} - {1}",element.Size,element.DesiredSize); } - exportColumn.DesiredSize = exportColumn.Size; - return exportColumn.Size; + return exportColumn.DesiredSize; } } diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/DataManager/Listhandling/CollectionSource.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/DataManager/Listhandling/CollectionSource.cs index 5000b9a9cc..98116e00db 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/DataManager/Listhandling/CollectionSource.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/DataManager/Listhandling/CollectionSource.cs @@ -131,12 +131,15 @@ namespace ICSharpCode.Reporting.DataManager.Listhandling public void Fill(List collection) { - foreach (IDataItem item in collection) + foreach (IPrintableObject item in collection) { - FillInternal(item); + if (item is IDataItem) { + FillInternal(item as IDataItem); + } } } + void FillInternal (IDataItem item) { item.DBValue = String.Empty; var p = listProperties.Find(item.ColumnName,true); 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 07b98092b9..ee1f4b6a34 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/ExportRenderer/FixedDocumentCreator.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/ExportRenderer/FixedDocumentCreator.cs @@ -64,25 +64,27 @@ namespace ICSharpCode.Reporting.ExportRenderer public TextBlock CreateTextBlock(ExportText exportText) { var textBlock = new TextBlock(); - - textBlock.Text = exportText.Text; + +// textBlock.Text = exportText.Text; + textBlock.Width = exportText.DesiredSize.Width; + textBlock.Height = exportText.DesiredSize.Height; textBlock.Foreground = ConvertBrush(exportText.ForeColor); SetFont(textBlock,exportText); textBlock.Background = ConvertBrush(exportText.BackColor); textBlock.TextWrapping = TextWrapping.WrapWithOverflow; - -// string [] inlines = exportText.Text.Split(System.Environment.NewLine.ToCharArray()); +// textBlock.TextWrapping = TextWrapping.NoWrap; + string [] inlines = exportText.Text.Split(System.Environment.NewLine.ToCharArray()); //string [] inlines = "jmb,.n,knn-.n.-n.n-.n.n.-"; -// for (int i = 0; i < inlines.Length; i++) { -// if (inlines[i].Length > 0) { -// textBlock.Inlines.Add(new Run(inlines[i])); - //// textBlock.Inlines.Add(new LineBreak()); -// } -// } -// var li = textBlock.Inlines.LastInline; -// textBlock.Inlines.Remove(li); + for (int i = 0; i < inlines.Length; i++) { + if (inlines[i].Length > 0) { + textBlock.Inlines.Add(new Run(inlines[i])); + textBlock.Inlines.Add(new LineBreak()); + } + } + var li = textBlock.Inlines.LastInline; + textBlock.Inlines.Remove(li); // SetDimension(textBlock,exportText.StyleDecorator); // textBlock.Background = ConvertBrush(exportText.StyleDecorator.BackColor); // SetContendAlignment(textBlock,exportText.StyleDecorator); diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/Converter/ContainerConverter.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/Converter/ContainerConverter.cs index 37b9ad94d6..ae362e42d0 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/Converter/ContainerConverter.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/Converter/ContainerConverter.cs @@ -41,9 +41,8 @@ namespace ICSharpCode.Reporting.PageBuilder.Converter public List CreateConvertedList(IReportContainer reportContainer, - Point position){ -//Console.WriteLine("CreateConvertedList {0}",reportContainer.Name); + var itemsList = new List(); foreach (var item in reportContainer.Items) { var exportColumn = ExportColumnFactory.CreateItem(item);