/// <summary> /// Contrói modelos de renderização em memória. /// </summary> /// <param name="p_pageheight">Altura da página.</param> /// <param name="p_pagewidth">Largura da página.</param> /// <param name="p_datafieldfont">Fonte do campo de dados.</param> /// <param name="p_groupheaderfont">Fonte do cabeçalho de grupo.</param> /// <param name="p_groupfooterfont">Fonte do rodapé de grupo.</param> private void BuildTemplates( float p_pageheight, float p_pagewidth, PDFjet.NET.Font p_datafieldfont, PDFjet.NET.Font p_groupheaderfont, PDFjet.NET.Font p_groupfooterfont ) { System.Collections.Generic.List<PDFjet.NET.Cell> v_row; PDFjet.NET.Cell v_cell; Spartacus.Reporting.Group v_group; int k, r, v_sectionrow, v_level; // modelo do detalhe ímpar this.v_detailoddtemplate = new System.Collections.Generic.List<System.Collections.Generic.List<PDFjet.NET.Cell>>(); for (v_sectionrow = 0; v_sectionrow < this.v_numrowsdetail; v_sectionrow++) { v_row = new System.Collections.Generic.List<PDFjet.NET.Cell>(); for (k = 0; k < this.v_fields.Count; k++) { if (((Spartacus.Reporting.Field)this.v_fields[k]).v_row == v_sectionrow) { v_cell = new PDFjet.NET.Cell(p_datafieldfont); v_cell.SetWidth(((p_pagewidth - (this.v_settings.v_leftmargin + this.v_settings.v_rightmargin)) * ((Spartacus.Reporting.Field)this.v_fields[k]).v_fill) / 100); switch (((Spartacus.Reporting.Field)this.v_fields[k]).v_align) { case Spartacus.Reporting.FieldAlignment.LEFT: v_cell.SetTextAlignment(PDFjet.NET.Align.LEFT); break; case Spartacus.Reporting.FieldAlignment.RIGHT: v_cell.SetTextAlignment(PDFjet.NET.Align.RIGHT); break; case Spartacus.Reporting.FieldAlignment.CENTER: v_cell.SetTextAlignment(PDFjet.NET.Align.CENTER); break; default: break; } v_cell.SetBgColor(this.v_settings.v_datafieldoddcolor); if (((Spartacus.Reporting.Field)this.v_fields[k]).v_border != null) { v_cell.SetBorder(PDFjet.NET.Border.TOP, ((Spartacus.Reporting.Field)this.v_fields[k]).v_border.v_top || this.v_settings.v_datafieldborder.v_top); v_cell.SetBorder(PDFjet.NET.Border.BOTTOM, ((Spartacus.Reporting.Field)this.v_fields[k]).v_border.v_bottom || this.v_settings.v_datafieldborder.v_bottom); v_cell.SetBorder(PDFjet.NET.Border.LEFT, ((Spartacus.Reporting.Field)this.v_fields[k]).v_border.v_left || this.v_settings.v_datafieldborder.v_left); v_cell.SetBorder(PDFjet.NET.Border.RIGHT, ((Spartacus.Reporting.Field)this.v_fields[k]).v_border.v_right || this.v_settings.v_datafieldborder.v_right); } else { v_cell.SetBorder(PDFjet.NET.Border.TOP, this.v_settings.v_datafieldborder.v_top); v_cell.SetBorder(PDFjet.NET.Border.BOTTOM, this.v_settings.v_datafieldborder.v_bottom); v_cell.SetBorder(PDFjet.NET.Border.LEFT, this.v_settings.v_datafieldborder.v_left); v_cell.SetBorder(PDFjet.NET.Border.RIGHT, this.v_settings.v_datafieldborder.v_right); } v_row.Add(v_cell); } } this.v_detailoddtemplate.Add(v_row); } // modelo do detalhe par this.v_detaileventemplate = new System.Collections.Generic.List<System.Collections.Generic.List<PDFjet.NET.Cell>>(); for (v_sectionrow = 0; v_sectionrow < this.v_numrowsdetail; v_sectionrow++) { v_row = new System.Collections.Generic.List<PDFjet.NET.Cell>(); for (k = 0; k < this.v_fields.Count; k++) { if (((Spartacus.Reporting.Field)this.v_fields[k]).v_row == v_sectionrow) { v_cell = new PDFjet.NET.Cell(p_datafieldfont); v_cell.SetWidth(((p_pagewidth - (this.v_settings.v_leftmargin + this.v_settings.v_rightmargin)) * ((Spartacus.Reporting.Field)this.v_fields[k]).v_fill) / 100); switch (((Spartacus.Reporting.Field)this.v_fields[k]).v_align) { case Spartacus.Reporting.FieldAlignment.LEFT: v_cell.SetTextAlignment(PDFjet.NET.Align.LEFT); break; case Spartacus.Reporting.FieldAlignment.RIGHT: v_cell.SetTextAlignment(PDFjet.NET.Align.RIGHT); break; case Spartacus.Reporting.FieldAlignment.CENTER: v_cell.SetTextAlignment(PDFjet.NET.Align.CENTER); break; default: break; } v_cell.SetBgColor(this.v_settings.v_datafieldevencolor); if (((Spartacus.Reporting.Field)this.v_fields[k]).v_border != null) { v_cell.SetBorder(PDFjet.NET.Border.TOP, ((Spartacus.Reporting.Field)this.v_fields[k]).v_border.v_top || this.v_settings.v_datafieldborder.v_top); v_cell.SetBorder(PDFjet.NET.Border.BOTTOM, ((Spartacus.Reporting.Field)this.v_fields[k]).v_border.v_bottom || this.v_settings.v_datafieldborder.v_bottom); v_cell.SetBorder(PDFjet.NET.Border.LEFT, ((Spartacus.Reporting.Field)this.v_fields[k]).v_border.v_left || this.v_settings.v_datafieldborder.v_left); v_cell.SetBorder(PDFjet.NET.Border.RIGHT, ((Spartacus.Reporting.Field)this.v_fields[k]).v_border.v_right || this.v_settings.v_datafieldborder.v_right); } else { v_cell.SetBorder(PDFjet.NET.Border.TOP, this.v_settings.v_datafieldborder.v_top); v_cell.SetBorder(PDFjet.NET.Border.BOTTOM, this.v_settings.v_datafieldborder.v_bottom); v_cell.SetBorder(PDFjet.NET.Border.LEFT, this.v_settings.v_datafieldborder.v_left); v_cell.SetBorder(PDFjet.NET.Border.RIGHT, this.v_settings.v_datafieldborder.v_right); } v_row.Add(v_cell); } } this.v_detaileventemplate.Add(v_row); } for (v_level = 0; v_level < this.v_groups.Count; v_level++) { v_group = (Spartacus.Reporting.Group)this.v_groups[v_level]; // modelo do cabeçalho do grupo if (v_group.v_showheader) { v_group.v_headertemplate = new System.Collections.Generic.List<System.Collections.Generic.List<PDFjet.NET.Cell>>(); r = 0; for (v_sectionrow = 0; v_sectionrow < v_group.v_numrowsheader; v_sectionrow++) { v_row = new System.Collections.Generic.List<PDFjet.NET.Cell>(); for (k = 0; k < v_group.v_headerfields.Count; k++) { if (((Spartacus.Reporting.Field)v_group.v_headerfields[k]).v_row == v_sectionrow) { v_cell = new PDFjet.NET.Cell(p_groupheaderfont); v_cell.SetWidth(((p_pagewidth - (this.v_settings.v_leftmargin + this.v_settings.v_rightmargin)) * ((Spartacus.Reporting.Field)v_group.v_headerfields[k]).v_fill) / 100); switch (((Spartacus.Reporting.Field)v_group.v_headerfields[k]).v_align) { case Spartacus.Reporting.FieldAlignment.LEFT: v_cell.SetTextAlignment(PDFjet.NET.Align.LEFT); break; case Spartacus.Reporting.FieldAlignment.RIGHT: v_cell.SetTextAlignment(PDFjet.NET.Align.RIGHT); break; case Spartacus.Reporting.FieldAlignment.CENTER: v_cell.SetTextAlignment(PDFjet.NET.Align.CENTER); break; default: break; } if (r % 2 == 0) v_cell.SetBgColor(this.v_settings.v_groupheaderevencolor); else v_cell.SetBgColor(this.v_settings.v_groupheaderoddcolor); if (((Spartacus.Reporting.Field)v_group.v_headerfields[k]).v_border != null) { v_cell.SetBorder(PDFjet.NET.Border.TOP, ((Spartacus.Reporting.Field)v_group.v_headerfields[k]).v_border.v_top || this.v_settings.v_groupheaderborder.v_top); v_cell.SetBorder(PDFjet.NET.Border.BOTTOM, ((Spartacus.Reporting.Field)v_group.v_headerfields[k]).v_border.v_bottom || this.v_settings.v_groupheaderborder.v_bottom); v_cell.SetBorder(PDFjet.NET.Border.LEFT, ((Spartacus.Reporting.Field)v_group.v_headerfields[k]).v_border.v_left || this.v_settings.v_groupheaderborder.v_left); v_cell.SetBorder(PDFjet.NET.Border.RIGHT, ((Spartacus.Reporting.Field)v_group.v_headerfields[k]).v_border.v_right || this.v_settings.v_groupheaderborder.v_right); } else { v_cell.SetBorder(PDFjet.NET.Border.TOP, this.v_settings.v_groupheaderborder.v_top); v_cell.SetBorder(PDFjet.NET.Border.BOTTOM, this.v_settings.v_groupheaderborder.v_bottom); v_cell.SetBorder(PDFjet.NET.Border.LEFT, this.v_settings.v_groupheaderborder.v_left); v_cell.SetBorder(PDFjet.NET.Border.RIGHT, this.v_settings.v_groupheaderborder.v_right); } v_row.Add(v_cell); } } v_group.v_headertemplate.Add(v_row); r++; } } // modelo do rodapé grupo if (v_group.v_showfooter) { v_group.v_footertemplate = new System.Collections.Generic.List<System.Collections.Generic.List<PDFjet.NET.Cell>>(); r = 0; for (v_sectionrow = 0; v_sectionrow < v_group.v_numrowsfooter; v_sectionrow++) { v_row = new System.Collections.Generic.List<PDFjet.NET.Cell>(); for (k = 0; k < v_group.v_footerfields.Count; k++) { if (((Spartacus.Reporting.Field)v_group.v_footerfields[k]).v_row == v_sectionrow) { v_cell = new PDFjet.NET.Cell(p_groupfooterfont); v_cell.SetWidth(((p_pagewidth - (this.v_settings.v_leftmargin + this.v_settings.v_rightmargin)) * ((Spartacus.Reporting.Field)v_group.v_footerfields[k]).v_fill) / 100); switch (((Spartacus.Reporting.Field)v_group.v_footerfields[k]).v_align) { case Spartacus.Reporting.FieldAlignment.LEFT: v_cell.SetTextAlignment(PDFjet.NET.Align.LEFT); break; case Spartacus.Reporting.FieldAlignment.RIGHT: v_cell.SetTextAlignment(PDFjet.NET.Align.RIGHT); break; case Spartacus.Reporting.FieldAlignment.CENTER: v_cell.SetTextAlignment(PDFjet.NET.Align.CENTER); break; default: break; } if (r % 2 == 0) v_cell.SetBgColor(this.v_settings.v_groupfooterevencolor); else v_cell.SetBgColor(this.v_settings.v_groupfooteroddcolor); if (((Spartacus.Reporting.Field)v_group.v_footerfields[k]).v_border != null) { v_cell.SetBorder(PDFjet.NET.Border.TOP, ((Spartacus.Reporting.Field)v_group.v_footerfields[k]).v_border.v_top || this.v_settings.v_groupfooterborder.v_top); v_cell.SetBorder(PDFjet.NET.Border.BOTTOM, ((Spartacus.Reporting.Field)v_group.v_footerfields[k]).v_border.v_bottom || this.v_settings.v_groupfooterborder.v_bottom); v_cell.SetBorder(PDFjet.NET.Border.LEFT, ((Spartacus.Reporting.Field)v_group.v_footerfields[k]).v_border.v_left || this.v_settings.v_groupfooterborder.v_left); v_cell.SetBorder(PDFjet.NET.Border.RIGHT, ((Spartacus.Reporting.Field)v_group.v_footerfields[k]).v_border.v_right || this.v_settings.v_groupfooterborder.v_right); } else { v_cell.SetBorder(PDFjet.NET.Border.TOP, this.v_settings.v_groupfooterborder.v_top); v_cell.SetBorder(PDFjet.NET.Border.BOTTOM, this.v_settings.v_groupfooterborder.v_bottom); v_cell.SetBorder(PDFjet.NET.Border.LEFT, this.v_settings.v_groupfooterborder.v_left); v_cell.SetBorder(PDFjet.NET.Border.RIGHT, this.v_settings.v_groupfooterborder.v_right); } v_row.Add(v_cell); } } v_group.v_footertemplate.Add(v_row); r++; } } } }
/// <summary> /// Renderiza cabeçalho de dados. /// </summary> /// <returns>Matriz representando o cabeçalho de dados.</returns> /// <param name="p_pageheight">Altura da página.</param> /// <param name="p_pagewidth">Largura da página.</param> /// <param name="p_dataheaderfont">Fonte do cabeçalho de dados.</param> private System.Collections.Generic.List<System.Collections.Generic.List<PDFjet.NET.Cell>> RenderDataHeader( float p_pageheight, float p_pagewidth, PDFjet.NET.Font p_dataheaderfont ) { System.Collections.Generic.List<System.Collections.Generic.List<PDFjet.NET.Cell>> v_data; System.Collections.Generic.List<PDFjet.NET.Cell> v_row; PDFjet.NET.Cell v_cell; int g, k, v_sectionrow; v_data = new System.Collections.Generic.List<System.Collections.Generic.List<PDFjet.NET.Cell>>(); this.v_numrowsdataheader = 0; for (g = this.v_groups.Count - 1; g >= 0; g--) { // renderizando titulos de cabeçalhos de grupos if (((Spartacus.Reporting.Group)this.v_groups[g]).v_showheadertitles) { this.v_numrowsdataheader += ((Spartacus.Reporting.Group)this.v_groups[g]).v_numrowsheader; for (v_sectionrow = 0; v_sectionrow < ((Spartacus.Reporting.Group)this.v_groups[g]).v_numrowsheader; v_sectionrow++) { v_row = new System.Collections.Generic.List<PDFjet.NET.Cell>(); for (k = 0; k < ((Spartacus.Reporting.Group)this.v_groups[g]).v_headerfields.Count; k++) { if (((Spartacus.Reporting.Field)((Spartacus.Reporting.Group)this.v_groups[g]).v_headerfields[k]).v_row == v_sectionrow) { v_cell = new PDFjet.NET.Cell(p_dataheaderfont); v_cell.SetText(((Spartacus.Reporting.Field)((Spartacus.Reporting.Group)this.v_groups[g]).v_headerfields[k]).v_title); v_cell.SetWidth(((p_pagewidth - (this.v_settings.v_leftmargin + this.v_settings.v_rightmargin)) * ((Spartacus.Reporting.Field)((Spartacus.Reporting.Group)this.v_groups[g]).v_headerfields[k]).v_fill) / 100); switch (((Spartacus.Reporting.Field)((Spartacus.Reporting.Group)this.v_groups[g]).v_headerfields[k]).v_align) { case Spartacus.Reporting.FieldAlignment.LEFT: v_cell.SetTextAlignment(PDFjet.NET.Align.LEFT); break; case Spartacus.Reporting.FieldAlignment.RIGHT: v_cell.SetTextAlignment(PDFjet.NET.Align.RIGHT); break; case Spartacus.Reporting.FieldAlignment.CENTER: v_cell.SetTextAlignment(PDFjet.NET.Align.CENTER); break; default: break; } v_cell.SetBgColor(this.v_settings.v_dataheadercolor); if (((Spartacus.Reporting.Field)((Spartacus.Reporting.Group)this.v_groups[g]).v_headerfields[k]).v_border != null) { v_cell.SetBorder(PDFjet.NET.Border.TOP, ((Spartacus.Reporting.Field)((Spartacus.Reporting.Group)this.v_groups[g]).v_headerfields[k]).v_border.v_top || this.v_settings.v_dataheaderborder.v_top); v_cell.SetBorder(PDFjet.NET.Border.BOTTOM, ((Spartacus.Reporting.Field)((Spartacus.Reporting.Group)this.v_groups[g]).v_headerfields[k]).v_border.v_bottom || this.v_settings.v_dataheaderborder.v_bottom); v_cell.SetBorder(PDFjet.NET.Border.LEFT, ((Spartacus.Reporting.Field)((Spartacus.Reporting.Group)this.v_groups[g]).v_headerfields[k]).v_border.v_left || this.v_settings.v_dataheaderborder.v_left); v_cell.SetBorder(PDFjet.NET.Border.RIGHT, ((Spartacus.Reporting.Field)((Spartacus.Reporting.Group)this.v_groups[g]).v_headerfields[k]).v_border.v_right || this.v_settings.v_dataheaderborder.v_right); } else { v_cell.SetBorder(PDFjet.NET.Border.TOP, this.v_settings.v_dataheaderborder.v_top); v_cell.SetBorder(PDFjet.NET.Border.BOTTOM, this.v_settings.v_dataheaderborder.v_bottom); v_cell.SetBorder(PDFjet.NET.Border.LEFT, this.v_settings.v_dataheaderborder.v_left); v_cell.SetBorder(PDFjet.NET.Border.RIGHT, this.v_settings.v_dataheaderborder.v_right); } v_row.Add(v_cell); } } v_data.Add(v_row); } } // renderizando titulos de rodapés de grupos if (((Spartacus.Reporting.Group)this.v_groups[g]).v_showfootertitles) { this.v_numrowsdataheader += ((Spartacus.Reporting.Group)this.v_groups[g]).v_numrowsfooter; for (v_sectionrow = 0; v_sectionrow < ((Spartacus.Reporting.Group)this.v_groups[g]).v_numrowsfooter; v_sectionrow++) { v_row = new System.Collections.Generic.List<PDFjet.NET.Cell>(); for (k = 0; k < ((Spartacus.Reporting.Group)this.v_groups[g]).v_footerfields.Count; k++) { if (((Spartacus.Reporting.Field)((Spartacus.Reporting.Group)this.v_groups[g]).v_footerfields[k]).v_row == v_sectionrow) { v_cell = new PDFjet.NET.Cell(p_dataheaderfont); v_cell.SetText(((Spartacus.Reporting.Field)((Spartacus.Reporting.Group)this.v_groups[g]).v_footerfields[k]).v_title); v_cell.SetWidth(((p_pagewidth - (this.v_settings.v_leftmargin + this.v_settings.v_rightmargin)) * ((Spartacus.Reporting.Field)((Spartacus.Reporting.Group)this.v_groups[g]).v_footerfields[k]).v_fill) / 100); switch (((Spartacus.Reporting.Field)((Spartacus.Reporting.Group)this.v_groups[g]).v_footerfields[k]).v_align) { case Spartacus.Reporting.FieldAlignment.LEFT: v_cell.SetTextAlignment(PDFjet.NET.Align.LEFT); break; case Spartacus.Reporting.FieldAlignment.RIGHT: v_cell.SetTextAlignment(PDFjet.NET.Align.RIGHT); break; case Spartacus.Reporting.FieldAlignment.CENTER: v_cell.SetTextAlignment(PDFjet.NET.Align.CENTER); break; default: break; } v_cell.SetBgColor(this.v_settings.v_dataheadercolor); if (((Spartacus.Reporting.Field)((Spartacus.Reporting.Group)this.v_groups[g]).v_footerfields[k]).v_border != null) { v_cell.SetBorder(PDFjet.NET.Border.TOP, ((Spartacus.Reporting.Field)((Spartacus.Reporting.Group)this.v_groups[g]).v_footerfields[k]).v_border.v_top || this.v_settings.v_dataheaderborder.v_top); v_cell.SetBorder(PDFjet.NET.Border.BOTTOM, ((Spartacus.Reporting.Field)((Spartacus.Reporting.Group)this.v_groups[g]).v_footerfields[k]).v_border.v_bottom || this.v_settings.v_dataheaderborder.v_bottom); v_cell.SetBorder(PDFjet.NET.Border.LEFT, ((Spartacus.Reporting.Field)((Spartacus.Reporting.Group)this.v_groups[g]).v_footerfields[k]).v_border.v_left || this.v_settings.v_dataheaderborder.v_left); v_cell.SetBorder(PDFjet.NET.Border.RIGHT, ((Spartacus.Reporting.Field)((Spartacus.Reporting.Group)this.v_groups[g]).v_footerfields[k]).v_border.v_right || this.v_settings.v_dataheaderborder.v_right); } else { v_cell.SetBorder(PDFjet.NET.Border.TOP, this.v_settings.v_dataheaderborder.v_top); v_cell.SetBorder(PDFjet.NET.Border.BOTTOM, this.v_settings.v_dataheaderborder.v_bottom); v_cell.SetBorder(PDFjet.NET.Border.LEFT, this.v_settings.v_dataheaderborder.v_left); v_cell.SetBorder(PDFjet.NET.Border.RIGHT, this.v_settings.v_dataheaderborder.v_right); } v_row.Add(v_cell); } } v_data.Add(v_row); } } } // renderizando titulos de campos de detalhe this.v_numrowsdataheader += this.v_numrowsdetail; for (v_sectionrow = 0; v_sectionrow < this.v_numrowsdetail; v_sectionrow++) { v_row = new System.Collections.Generic.List<PDFjet.NET.Cell>(); for (k = 0; k < this.v_fields.Count; k++) { if (((Spartacus.Reporting.Field)this.v_fields[k]).v_row == v_sectionrow) { v_cell = new PDFjet.NET.Cell(p_dataheaderfont); v_cell.SetText(((Spartacus.Reporting.Field)this.v_fields[k]).v_title); v_cell.SetWidth(((p_pagewidth - (this.v_settings.v_leftmargin + this.v_settings.v_rightmargin)) * ((Spartacus.Reporting.Field)this.v_fields[k]).v_fill) / 100); switch (((Spartacus.Reporting.Field)this.v_fields[k]).v_align) { case Spartacus.Reporting.FieldAlignment.LEFT: v_cell.SetTextAlignment(PDFjet.NET.Align.LEFT); break; case Spartacus.Reporting.FieldAlignment.RIGHT: v_cell.SetTextAlignment(PDFjet.NET.Align.RIGHT); break; case Spartacus.Reporting.FieldAlignment.CENTER: v_cell.SetTextAlignment(PDFjet.NET.Align.CENTER); break; default: break; } v_cell.SetBgColor(this.v_settings.v_dataheadercolor); if (((Spartacus.Reporting.Field)this.v_fields[k]).v_border != null) { v_cell.SetBorder(PDFjet.NET.Border.TOP, ((Spartacus.Reporting.Field)this.v_fields[k]).v_border.v_top || this.v_settings.v_dataheaderborder.v_top); v_cell.SetBorder(PDFjet.NET.Border.BOTTOM, ((Spartacus.Reporting.Field)this.v_fields[k]).v_border.v_bottom || this.v_settings.v_dataheaderborder.v_bottom); v_cell.SetBorder(PDFjet.NET.Border.LEFT, ((Spartacus.Reporting.Field)this.v_fields[k]).v_border.v_left || this.v_settings.v_dataheaderborder.v_left); v_cell.SetBorder(PDFjet.NET.Border.RIGHT, ((Spartacus.Reporting.Field)this.v_fields[k]).v_border.v_right || this.v_settings.v_dataheaderborder.v_right); } else { v_cell.SetBorder(PDFjet.NET.Border.TOP, this.v_settings.v_dataheaderborder.v_top); v_cell.SetBorder(PDFjet.NET.Border.BOTTOM, this.v_settings.v_dataheaderborder.v_bottom); v_cell.SetBorder(PDFjet.NET.Border.LEFT, this.v_settings.v_dataheaderborder.v_left); v_cell.SetBorder(PDFjet.NET.Border.RIGHT, this.v_settings.v_dataheaderborder.v_right); } v_row.Add(v_cell); } } v_data.Add(v_row); } return v_data; }