override public Point GetExtension(PrintOut adriver, Point MaxExtent, bool ForcePartial) { TextObjectStruct atext; atext = GetTextObject(); // Items printed only one time, have no extension if (PrintOnlyOne) { if (FOldString == atext.Text) { return(new Point(0, 0)); } } int aposition; bool IsPartial; IsPartial = false; Point aresult = base.GetExtension(adriver, MaxExtent, ForcePartial); if ((MultiPage) || ForcePartial) { MaxExtent.X = aresult.X; aposition = MetaFile.CalcTextExtent(adriver, MaxExtent, atext); if (aposition < atext.Text.Length) { IsPartial = true; } atext.Text = atext.Text.Substring(0, aposition); aresult = adriver.TextExtent(atext, aresult); if (IsPartial) { aresult.Y = MaxExtent.Y; } } else { aresult = adriver.TextExtent(atext, aresult); } LastExtent = aresult; return(aresult); }
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"); } } }