private static DocumentPDF printParagraph(StampaVO.Paragraph paragraph, DocumentPDF docPDF) { try { string[] testo; testo = paragraph.text.Split('&'); StampaVO.Font font = paragraph.font; Font font1 = FontFactory.GetFont(font.name, font.size, Utils.getFontStyle(font.style), Utils.getColor(font.color)); for (int i = 0; i < testo.Length; i++) { Paragraph p = new Paragraph(new Phrase(testo[i], font1)); p.IndentationLeft = paragraph.indentationLeft; p.IndentationRight = paragraph.indentationRight; p.Alignment = Utils.getAlign(paragraph.align); docPDF.Add(p); } } catch (Exception ex) { docPDF.Close(); writer.Close(); throw new ReportException(ErrorCode.IncompletePDFFile, "Errore nella scrittura dei dati: " + ex.Message); } return(docPDF); }
private static StampaVO.Paragraph getParagrafo(XmlNode nodo) { StampaVO.Paragraph paragrafo = null; if (nodo != null) { paragrafo = new StampaVO.Paragraph(); paragrafo.align = Utils.getAttribute("align", nodo); paragrafo.font = getFont(nodo); paragrafo.target = Utils.getAttribute("target", nodo); paragrafo.text = nodo.InnerText; if (!string.IsNullOrEmpty(Utils.getAttribute("indentationLeft", nodo))) { paragrafo.indentationLeft = Convert.ToInt16(Utils.getAttribute("indentationLeft", nodo)); } if (!string.IsNullOrEmpty(Utils.getAttribute("indentationRight", nodo))) { paragrafo.indentationRight = Convert.ToInt16(Utils.getAttribute("indentationRight", nodo)); } } return(paragrafo); }
private static ArrayList setDati() { ArrayList dati = new ArrayList(); //XmlNode nodoDati = nodoReport.SelectSingleNode("dati"); XmlNodeList nodoDati1 = nodoReport.SelectNodes("dati"); foreach (XmlNode nodoDati in nodoDati1) //if (nodoDati!=null) { if (nodoDati.ChildNodes.Count > 0) { foreach (XmlNode nodo in nodoDati.ChildNodes) { if (nodo.Name.Equals("paragrafo")) { StampaVO.Paragraph par = getParagrafo(nodo); if (par != null) { dati.Add(par); } } else if (nodo.Name.Equals("tabella")) { StampaVO.Table tab = getTabella(nodo); if (tab != null) { dati.Add(tab); } } // else if (nodo.Name.Equals("spazio")) // getSpazio(nodo); } } } return(dati); }