-none- 2007-09-17 - By N@(protected)
Back Hi, It's the first time I use this library (iTextSharp) and I've some problem with nested table. Every time I've this exception: "Adding a cell at the location (1,0) with a colspan of 1 and a rowspan of 1 is illegal (beyond boundaries/overlapping)."
The primary table is definde as (1,6) so I've one columns ad six rows...
Every row (cell) has a nested table inside it. The problem start with the second row wich have a (2,2) table nested. this is the code for the second row:
Table tableSecondRiga = new Table(2, 2); tableSecondRiga.AutoFillEmptyCells = false; //tableSecondRiga.Height = (float)((4.1 / CMTOINCH) * INCHTOPONTS); Chunk mittenteHeaderChunk = new Chunk("Mittente", new iTextSharp.text.Font(ITS.Font.TIMES_ROMAN, 16, ITS.Font.BOLDITALIC, ITS.Color.WHITE)); Chunk destinatarioHeaderChunk = new Chunk("Destinatario", new iTextSharp.text.Font(ITS.Font.TIMES_ROMAN, 16, ITS.Font.BOLDITALIC, ITS.Color.WHITE)); Cell mittenteHeader = new Cell(mittenteHeaderChunk); Cell destinatarioHeader = new Cell(destinatarioHeaderChunk); mittenteHeader.HorizontalAlignment = Cell.ALIGN_MIDDLE; destinatarioHeader.HorizontalAlignment = Cell.ALIGN_MIDDLE; mittenteHeader.BackgroundColor = ITS.Color.BLUE; destinatarioHeader.BackgroundColor = ITS.Color.BLUE; mittenteHeader.Width = 50; destinatarioHeader.Width = 50; //mittenteHeader.Height = (float)((0.8/CMTOINCH)*INCHTOPONTS); destinatarioHeader.Width = (float)((0.8 / CMTOINCH) * INCHTOPONTS); //tableSecondRiga.AddCell(mittenteHeader, 1, 1); //tableSecondRiga.AddCell(destinatarioHeader, 1, 2); tableSecondRiga.AddCell(mittenteHeader, 0, 0); tableSecondRiga.AddCell(destinatarioHeader, 0, 1); tableSecondRiga.EndHeaders(); // Mittente Paragraph nomeMittentePar = new Paragraph(mittente, new iTextSharp.text.Font(ITS.Font.TIMES_ROMAN, 14)); Paragraph indMittentePar = new Paragraph(indirizzoMittente, new iTextSharp.text.Font(ITS.Font.TIMES_ROMAN, 14)); Paragraph capCittaMittentePar = new Paragraph(capMittente + " " + cittaMittente, new iTextSharp.text.Font(ITS.Font.TIMES_ROMAN, 14)); Paragraph agenziaUoMittentePar; if (mittente.CompareTo("Sogei") == 0) agenziaUoMittentePar = new Paragraph(descUOMittente, new iTextSharp.text.Font(ITS.Font.TIMES_ROMAN, 14)); else agenziaUoMittentePar = new Paragraph(agenziaMittente, new iTextSharp.text.Font(ITS.Font.TIMES_ROMAN, 14)); Cell mittenteValueCell = new Cell(); mittenteValueCell.Add(nomeMittentePar); mittenteValueCell.Add(indMittentePar); mittenteValueCell.Add(agenziaUoMittentePar); mittenteValueCell.Add(capCittaMittentePar); mittenteValueCell.Width = 50; //mittenteValueCell.Height = (float)((3.3 / CMTOINCH) * INCHTOPONTS); //tableSecondRiga.AddCell(mittenteValueCell, 2, 1); tableSecondRiga.AddCell(mittenteValueCell, 1,0); // Destinatario Paragraph nomeDestinatarioPar = new Paragraph(destinatario, new iTextSharp.text.Font(ITS.Font.TIMES_ROMAN, 14)); Paragraph indDestinatarioPar = new Paragraph(indirizzoDestinatario, new iTextSharp.text.Font( ITS.Font.TIMES_ROMAN, 14)); Paragraph capCittaDestinatarioPar = new Paragraph(capDestinatario + " " + cittaDestinatario, new iTextSharp.text.Font(ITS.Font.TIMES_ROMAN, 14)); Paragraph agenziaUoDestinatarioPar; if (mittente.CompareTo("Sogei") == 0) agenziaUoDestinatarioPar = new Paragraph(descUODestinatario, new iTextSharp.text.Font(ITS.Font.TIMES_ROMAN, 14)); else agenziaUoDestinatarioPar = new Paragraph(agenziaDestinatario, new iTextSharp.text.Font(ITS.Font.TIMES_ROMAN, 14)); Cell destinatarioValueCell = new Cell(); destinatarioValueCell.Add(nomeDestinatarioPar); destinatarioValueCell.Add(indDestinatarioPar); destinatarioValueCell.Add(agenziaUoDestinatarioPar); destinatarioValueCell.Add(capCittaDestinatarioPar); destinatarioValueCell.Width = 50; //destinatarioValueCell.Height = (float)((3.3 / CMTOINCH) * INCHTOPONTS); //tableSecondRiga.AddCell(destinatarioValueCell, 2, 2); tableSecondRiga.AddCell(destinatarioValueCell, 1, 1); Cell riga2Cell = new Cell(tableSecondRiga); //table.AddCell(riga2Cell, 1, 0); table.AddCell(riga2Cell);
I saw that someone posted this error thinking it wold be a bug in 4.0.4, but with no response... Someone knows the solution?? -- Ciao da N@(protected) (MSN Messenger: napoleone1981@(protected)) "Le battaglie si vincono con gli uomini che si hanno, non con quelli che si vorrebbero" (Napoleone Bonaparte) "Le cose che possiedi prima o poi ti possiedono..." (Fight Club) "Le donne possono avere bambini...gli uomini computers" (Anonimo)
Hi,<br>It's the first time I use this library (iTextSharp) and I've some problem with nested table. Every time I've this exception:<br>" ;Adding a cell at the location (1,0) with a colspan of 1 and a rowspan of 1 is illegal (beyond boundaries/overlapping)." <br><br>The primary table is definde as (1,6) so I've one columns ad six rows...<br><br>Every row (cell) has a nested table inside it. The problem start with the second row wich have a (2,2) table nested.<br>this is the code for the second row: <br><br> Table tableSecondRiga = new Table(2, 2);<br>   ; tableSecondRiga.AutoFillEmptyCells = false;<br> / /tableSecondRiga.Height = (float)((4.1 / CMTOINCH) * INCHTOPONTS);<br> Chunk mittenteHeaderChunk = new Chunk("Mittente", new iTextSharp.text.Font(ITS.Font.TIMES_ROMAN, 16, ITS.Font.BOLDITALIC, ITS.Color .WHITE));<br> Chunk destinatarioHeaderChunk = new Chunk("Destinatario", new iTextSharp.text.Font(ITS.Font.TIMES_ROMAN, 16, ITS.Font.BOLDITALIC, ITS.Color.WHITE));<br> Cell mittenteHeader = new Cell (mittenteHeaderChunk);<br> Cell destinatarioHeader = new Cell(destinatarioHeaderChunk);<br> mittenteHeader.HorizontalAlignment = Cell.ALIGN_MIDDLE;<br> destinatarioHeader.HorizontalAlignment = Cell.ALIGN_MIDDLE;<br> mittenteHeader.BackgroundColor = ITS.Color.BLUE;<br> destinatarioHeader.BackgroundColor = ITS.Color.BLUE ;<br> mittenteHeader.Width = 50;<br> destinatarioHeader.Width = 50;<br> //mittenteHeader.Height = (float)((0 .8/CMTOINCH)*INCHTOPONTS);<br> destinatarioHeader.Width = (float)((0.8 / CMTOINCH) * INCHTOPONTS);<br>   ; //tableSecondRiga.AddCell(mittenteHeader, 1, 1);<br> //tableSecondRiga .AddCell(destinatarioHeader, 1, 2);<br>   ; tableSecondRiga.AddCell(mittenteHeader, 0, 0); <br> tableSecondRiga.AddCell(destinatarioHeader, 0, 1);<br> tableSecondRiga.EndHeaders();<br> // Mittente <br> Paragraph nomeMittentePar = new Paragraph(mittente, new iTextSharp.text.Font (ITS.Font.TIMES_ROMAN, 14));<br>   ; Paragraph indMittentePar = new Paragraph(indirizzoMittente, new iTextSharp.text.Font(ITS.Font.TIMES_ROMAN, 14));<br>   ; Paragraph capCittaMittentePar = new Paragraph(capMittente + " " + cittaMittente, new iTextSharp.text.Font(ITS.Font.TIMES_ROMAN, 14));<br> Paragraph agenziaUoMittentePar;<br> if (mittente .CompareTo("Sogei") == 0)<br>   ; agenziaUoMittentePar = new Paragraph(descUOMittente, new iTextSharp.text.Font(ITS.Font.TIMES_ROMAN, 14));<br> else<br>   ; agenziaUoMittentePar = new Paragraph(agenziaMittente, new iTextSharp.text.Font (ITS.Font.TIMES_ROMAN, 14));<br> Cell mittenteValueCell = new Cell(); <br> mittenteValueCell.Add(nomeMittentePar);<br> mittenteValueCell.Add(indMittentePar);<br> mittenteValueCell .Add(agenziaUoMittentePar);<br> mittenteValueCell.Add(capCittaMittentePar); <br> mittenteValueCell.Width = 50;<br> //mittenteValueCell.Height = (float)((3.3 / CMTOINCH) * INCHTOPONTS);<br> //tableSecondRiga.AddCell(mittenteValueCell, 2, 1);<br> tableSecondRiga.AddCell (mittenteValueCell, 1,0);<br> // Destinatario<br> Paragraph nomeDestinatarioPar = new Paragraph (destinatario, new iTextSharp.text.Font(ITS.Font.TIMES_ROMAN, 14));<br> Paragraph indDestinatarioPar = new Paragraph(indirizzoDestinatario, new iTextSharp.text.Font(ITS.Font.TIMES_ROMAN, 14));<br> Paragraph capCittaDestinatarioPar = new Paragraph(capDestinatario + " " + cittaDestinatario, new iTextSharp.text.Font(ITS.Font.TIMES_ROMAN, 14));<br> Paragraph agenziaUoDestinatarioPar;<br> if (mittente.CompareTo("Sogei") == 0)<br> agenziaUoDestinatarioPar = new Paragraph(descUODestinatario, new iTextSharp.text.Font(ITS.Font.TIMES_ROMAN , 14));<br> else<br>   ; agenziaUoDestinatarioPar = new Paragraph(agenziaDestinatario , new iTextSharp.text.Font(ITS.Font.TIMES_ROMAN, 14));<br> Cell destinatarioValueCell = new Cell();<br> destinatarioValueCell.Add(nomeDestinatarioPar);<br> destinatarioValueCell.Add (indDestinatarioPar);<br> destinatarioValueCell.Add(agenziaUoDestinatarioPar);<br>   ; destinatarioValueCell .Add (capCittaDestinatarioPar);<br> destinatarioValueCell.Width = 50;<br> //destinatarioValueCell.Height = (float)((3.3 / CMTOINCH) * INCHTOPONTS);<br> //tableSecondRiga.AddCell(destinatarioValueCell, 2, 2); <br> tableSecondRiga.AddCell(destinatarioValueCell, 1, 1);<br> Cell riga2Cell = new Cell (tableSecondRiga);<br> //table.AddCell(riga2Cell, 1, 0);<br> table.AddCell(riga2Cell);<br clear="all"> <br>I saw that someone posted this error thinking it wold be a bug in 4.0.4, but with no response... Someone knows the solution??<br>-- <br>Ciao da<br>N @(protected) (MSN Messenger: <a href="mailto:napoleone1981@(protected)">napoleone1981 @(protected) </a>)<br>"Le battaglie si vincono con gli uomini che si hanno, non con quelli che<br>si vorrebbero" (Napoleone Bonaparte)<br>"Le cose che possiedi prima o poi ti possiedono..." (Fight Club)<br>"Le donne possono avere bambini...gli uomini computers" (Anonimo)
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ __ ____ ____ ____ ____ ____ ____ ____ ____ ____ iText-questions mailing list iText-questions@(protected) https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://itext.ugent.be/itext-in-action/
|
|