コード例 #1
0
 private void GeneraSezioneTabella(SezioneTabella sezione, XmlWriter writer, DataTable dt, Padding padding, float height)
 {
     string nomeSezione = "", templateValore = "", valore = "";
     CellColors colors = null;
     switch (sezione)
     {
         case SezioneTabella.Header:
             {
                 nomeSezione = "Header";
                 templateValore = "{0}";
                 colors = new CellColors(Color.Black, Color.White);
                 break;
             }
         case SezioneTabella.Details:
             {
                 nomeSezione = "Details";
                 templateValore = "=Fields!{0}.Value";
                 break;
             }
         case SezioneTabella.Footer:
             {
                 nomeSezione = "Footer";
                 templateValore = "{0}";
                 break;
             }
     }
     writer.WriteStartElement(nomeSezione);
     {
         if (sezione == SezioneTabella.Header)
             writer.WriteElementString("RepeatOnNewPage", "true");
         writer.WriteStartElement("TableRows");
         {
             writer.WriteStartElement("TableRow");
             {
                 writer.WriteElementString("Height", height.ToString(ci) + "cm");
                 writer.WriteStartElement("TableCells");
                 {
                     for (int i = 0; i < dt.Columns.Count; i++)
                     {
                         writer.WriteStartElement("TableCell");
                         {
                             writer.WriteStartElement("ReportItems");
                             {
                                 valore = String.Format(templateValore, dt.Columns[i].ColumnName);
                                 GeneraTextBox(writer, "textbox" + nomeSezione + i, RectangleF.Empty, padding, colors, valore);
                             }
                             writer.WriteEndElement();
                         }
                         writer.WriteEndElement();
                     }
                 }
                 writer.WriteEndElement();
             }
             writer.WriteEndElement();
         }
         writer.WriteEndElement();
     }
     writer.WriteEndElement();
 }
コード例 #2
0
        private void GeneraTextBox(XmlWriter writer, string textboxName, RectangleF dimensioni, Padding padding, CellColors colors, string value)
        {
            writer.WriteStartElement("Textbox");
            writer.WriteAttributeString("Name", textboxName);
            {
                writer.WriteElementString("rd", "DefaultName", nsRd, textboxName);
                if (dimensioni != RectangleF.Empty)
                {
                    writer.WriteElementString("Top", dimensioni.Top.ToString(ci) + "cm");
                    writer.WriteElementString("Left", dimensioni.Left.ToString(ci) + "cm");
                    writer.WriteElementString("Width", dimensioni.Width.ToString(ci) + "cm");
                    writer.WriteElementString("Height", dimensioni.Height.ToString(ci) + "cm");
                }
                writer.WriteElementString("CanGrow", "true");
                writer.WriteElementString("Value", value);
                if (padding != null)
                {
                    writer.WriteStartElement("Style");
                    {
                        writer.WriteStartElement("BorderStyle");
                        {
                            writer.WriteElementString("Default", "Solid");
                        }
                        writer.WriteEndElement();

                        if (colors != null)
                        {
                            writer.WriteElementString("Color", colors.ForegroundColor.Name);
                            writer.WriteElementString("BackgroundColor", colors.BackgroundColor.Name);
                        }

                        writer.WriteElementString("PaddingLeft", padding.Left.ToString(ci) + "pt");
                        writer.WriteElementString("PaddingRight", padding.Right.ToString(ci) + "pt");
                        writer.WriteElementString("PaddingTop", padding.Top.ToString(ci) + "pt");
                        writer.WriteElementString("PaddingBottom", padding.Bottom.ToString(ci) + "pt");
                    }
                    writer.WriteEndElement();
                }
            }
            writer.WriteEndElement();
        }