@@ -59,7 +59,7 @@ public static Canvas CreateContainer(ExportContainer container) {
5959 return canvas ;
6060 }
6161
62-
62+ /*
6363 public static TextBlock CreateTextBlock(ExportText exportText,bool setBackcolor){
6464
6565 var textBlock = new TextBlock();
@@ -79,8 +79,9 @@ public static TextBlock CreateTextBlock(ExportText exportText,bool setBackcolor)
7979 MeasureTextBlock (textBlock,exportText);
8080 return textBlock;
8181 }
82+ */
8283
83-
84+ /*
8485 static void CheckForNewLine(TextBlock textBlock,ExportText exportText) {
8586 string [] inlines = exportText.Text.Split(Environment.NewLine.ToCharArray());
8687 for (int i = 0; i < inlines.Length; i++) {
@@ -101,22 +102,15 @@ static void MeasureTextBlock(TextBlock textBlock,ExportText exportText)
101102 textBlock.Height = wpfSize.Height;
102103 }
103104
105+ */
104106
107+ /*
105108 static Size MeasureTextInWpf(ExportText exportText){
106109
107110 if (exportText.CanGrow) {
108- var formattedText = new FormattedText ( exportText . Text ,
109- CultureInfo . CurrentCulture ,
110- FlowDirection . LeftToRight ,
111- new Typeface ( exportText . Font . FontFamily . Name ) ,
112- exportText . Font . Size ,
113- new SolidColorBrush ( exportText . ForeColor . ToWpf ( ) ) ,
114- null ,
115- TextFormattingMode . Display ) ;
111+ var formattedText = NewMethod(exportText);
116112
117113 formattedText.MaxTextWidth = exportText.DesiredSize.Width * 96.0 / 72.0;
118- // ft.MaxTextHeight = exportText.DesiredSize.Height + 5 * 96.0 / 72.0;
119- // ft.MaxTextHeight = Double.MaxValue ;
120114
121115 formattedText.SetFontSize(Math.Floor(exportText.Font.Size * 96.0 / 72.0));
122116
@@ -127,6 +121,34 @@ static Size MeasureTextInWpf(ExportText exportText){
127121 }
128122 return new Size(exportText.Size.Width,exportText.Size.Height);
129123 }
124+
125+ */
126+
127+
128+ public static FormattedText CreateFormattedText ( ExportText exportText )
129+ {
130+ var formattedText = new FormattedText ( exportText . Text ,
131+ CultureInfo . CurrentCulture ,
132+ FlowDirection . LeftToRight ,
133+ new Typeface ( exportText . Font . FontFamily . Name ) ,
134+ exportText . Font . Size ,
135+ new SolidColorBrush ( exportText . ForeColor . ToWpf ( ) ) , null , TextFormattingMode . Display ) ;
136+
137+ formattedText . MaxTextWidth = exportText . DesiredSize . Width * 96.0 / 72.0 ;
138+ formattedText . SetFontSize ( Math . Floor ( exportText . Font . Size * 96.0 / 72.0 ) ) ;
139+
140+ var td = new TextDecorationCollection ( ) ;
141+ CheckUnderline ( td , exportText ) ;
142+ formattedText . SetTextDecorations ( td ) ;
143+ return formattedText ;
144+ }
145+
146+ static void CheckUnderline ( TextDecorationCollection td , ExportText exportText )
147+ {
148+ if ( exportText . Font . Underline ) {
149+ td . Add ( new TextDecoration { Location = TextDecorationLocation . Underline } ) ;
150+ }
151+ }
130152
131153
132154 static Canvas CreateCanvas ( ExportContainer container ) {
@@ -158,7 +180,7 @@ static void SetPosition (UIElement element,IExportColumn exportColumn) {
158180 FixedPage . SetTop ( element , exportColumn . Location . Y ) ;
159181 }
160182
161-
183+ /*
162184 static void SetFont(TextBlock textBlock,IExportText exportText){
163185 textBlock.FontFamily = new FontFamily(exportText.Font.FontFamily.Name);
164186
@@ -180,7 +202,7 @@ static void SetFont(TextBlock textBlock,IExportText exportText){
180202 CreateStrikeout(textBlock,exportText);
181203 }
182204 }
183-
205+ */
184206
185207 static void SetContentAlignment ( TextBlock textBlock , ExportText exportText )
186208 {
@@ -244,7 +266,7 @@ static void CreateStrikeout (TextBlock textBlock,IExportText exportColumn ){
244266 textBlock . TextDecorations . Add ( strikeOut ) ;
245267 }
246268
247-
269+ /*
248270 static void CreateUnderline(TextBlock textBlock,IExportText exportColumn){
249271 if (exportColumn == null)
250272 throw new ArgumentNullException("exportColumn");
@@ -256,14 +278,15 @@ static void CreateUnderline(TextBlock textBlock,IExportText exportColumn){
256278 underLine.PenThicknessUnit = TextDecorationUnit.FontRecommended;
257279 textBlock.TextDecorations.Add(underLine);
258280 }
259-
281+ */
260282
261283 public static Pen CreateWpfPen ( IReportObject exportColumn ) {
262284 if ( exportColumn == null )
263285 throw new ArgumentNullException ( "exportColumn" ) ;
264286 var pen = new Pen ( ) ;
265287 pen . Brush = ConvertBrush ( exportColumn . ForeColor ) ;
266288 pen . Thickness = 1 ;
289+
267290 var exportGraphics = exportColumn as IExportGraphics ;
268291 if ( exportGraphics != null ) {
269292 pen . Thickness = exportGraphics . Thickness ;
0 commit comments