private TextObjectStruct GetTextObject() { int aalign; TextObjectStruct aresult = new TextObjectStruct(); aresult.Text = GetText(); aresult.LFontName = LFontName; aresult.WFontName = WFontName; aresult.FontSize = FontSize; aresult.FontRotation = FontRotation; aresult.FontStyle = (short)FontStyle; aresult.Type1Font = Type1Font; aresult.FontColor = FontColor; aresult.CutText = CutText; aalign = PrintAlignment | VPrintAlignment; if (SingleLine) { aalign = aalign | MetaFile.AlignmentFlags_SingleLine; } aresult.Alignment = aalign; aresult.WordWrap = WordWrap; aresult.RightToLeft = RightToLeft; aresult.PrintStep = PrintStep; return(aresult); }
/// <summary> /// Obtain text extent /// </summary> override public Point TextExtent(TextObjectStruct aobj, Point extent) { return(extent); }
override protected void DoPrint(PrintOut adriver, int aposx, int aposy, int newwidth, int newheight, MetaFile metafile, Point MaxExtent, ref bool PartialPrint) { int newposition; string avalue; base.DoPrint(adriver, aposx, aposy, newwidth, newheight, metafile, MaxExtent, ref PartialPrint); LastMetaIndex = -1; TextObjectStruct TextObj = GetTextObject(); if (PrintOnlyOne) { if (FOldString == TextObj.Text) { return; } } FOldString = TextObj.Text; if (MultiPage || FForcedPartial) { MaxExtent.X = PrintWidth; newposition = MetaFile.CalcTextExtent(Report.Driver, MaxExtent, TextObj); if (newposition < TextObj.Text.Length) { if (!FIsPartial) { PartialPos = 0; } FIsPartial = true; PartialPrint = true; PartialPos = PartialPos + newposition; TextObj.Text = TextObj.Text.Substring(0, newposition); } else { FIsPartial = false; FForcedPartial = false; } } MetaPage apage = metafile.Pages[metafile.CurrentPage]; MetaObjectText aobj = new MetaObjectText(); aobj.MetaType = MetaObjectType.Text; aobj.Left = aposx; aobj.Top = aposy; aobj.Width = PrintWidth; aobj.Height = PrintHeight; aobj.Alignment = TextObj.Alignment; aobj.PrintStep = PrintStep; aobj.BackColor = BackColor; aobj.Transparent = Transparent; aobj.CutText = CutText; aobj.FontColor = FontColor; aobj.FontRotation = FontRotation; aobj.Type1Font = Type1Font; aobj.FontSize = FontSize; aobj.FontStyle = (short)FontStyle; aobj.TextP = apage.AddString(TextObj.Text); aobj.TextS = TextObj.Text.Length; aobj.WordWrap = WordWrap; aobj.LFontNameP = apage.AddString(LFontName); aobj.LFontNameS = LFontName.Length; aobj.WFontNameP = apage.AddString(WFontName); aobj.WFontNameS = WFontName.Length; apage.Objects.Add(aobj); LastMetaIndex = metafile.Pages[metafile.CurrentPage].Objects.Count - 1; // Is Total pages variable? if (IsPageCount) { Report.AddTotalPagesItem(metafile.CurrentPage, metafile.Pages[metafile.CurrentPage].Objects.Count - 1, DisplayFormat); } if (ExportValue.VarType != VariantType.Null) { try { avalue = FExportValue.ToString(ExportDisplayFormat, ParamType.Unknown, true); MetaObjectExport nobj = new MetaObjectExport(); nobj.MetaType = MetaObjectType.Export; nobj.Left = aposx; nobj.Top = aposy; nobj.Width = PrintWidth; nobj.Height = PrintHeight; nobj.TextExpP = apage.AddString(avalue); nobj.TextExpS = avalue.Length; nobj.Line = ExportLine; nobj.Position = ExportPosition; nobj.DoNewLine = ExportDoNewLine; nobj.Size = ExportSize; apage.Objects.Add(nobj); } catch (Exception E) { throw new ReportException(E.Message + "Expression-" + Name + " ExportDisplayFormat", this, "ExportDisplayFormat"); } } }