命名空间 'iTextSharp.text' 中不存在类型或命名空间名称 'Table'
The type or namespace name 'Table' does not exist in the namespace 'iTextSharp.text'
您好,在处理这个已经编写好的代码时,我遇到了解决这个问题的问题。请帮帮我。
在下面的代码中,itextsharp.text.table 发现单元格不存在的问题,我添加了 itexsharp dll 以避免它仍然没有被删除。
using iTextSharp.text;
using iTextSharp.text.pdf;
...
iTextSharp.text.Table dataTable = new iTextSharp.text.Table(2);
dataTable.DefaultHorizontalAlignment = Element.ALIGN_LEFT;
dataTable.DefaultVerticalAlignment = Element.ALIGN_MIDDLE;
dataTable.Border = 1;
dataTable.AutoFillEmptyCells = false;
dataTable.Padding = 1;
dataTable.SpaceInsideCell = 1;
dataTable.WidthPercentage = 100;
dataTable.Convert2pdfptable = true;
dataTable.TableFitsPage = true;
//=============Adding 01 Row==================
iTextSharp.text.Image img = iTextSharp.text.Image.GetInstance("images/LOGO4.GIF");
iTextSharp.text.Image address = iTextSharp.text.Image.GetInstance("images/address3.GIF");
Cell logo = new Cell(img);
dataTable.AddCell(logo);
Cell addres = new Cell(address);
dataTable.AddCell(addres);
...
尽管我阅读了一些相关的 post 和文章,但仍无法解决。
您可能正在使用旧版本的已弃用库版本(Table 已被 PdfPTable) (iTextSharp/iText 5 has been deprecated in favor of iText 7, which has the exact same license model). In any case, you can check out documentation about tables for iTextSharp/iText 5 here and here. For iText 7, you can find similar documentation here and here 取代(不幸的是,这些都是 Java 示例,但 API 几乎是一样的)。
您好,在处理这个已经编写好的代码时,我遇到了解决这个问题的问题。请帮帮我。
在下面的代码中,itextsharp.text.table 发现单元格不存在的问题,我添加了 itexsharp dll 以避免它仍然没有被删除。
using iTextSharp.text;
using iTextSharp.text.pdf;
...
iTextSharp.text.Table dataTable = new iTextSharp.text.Table(2);
dataTable.DefaultHorizontalAlignment = Element.ALIGN_LEFT;
dataTable.DefaultVerticalAlignment = Element.ALIGN_MIDDLE;
dataTable.Border = 1;
dataTable.AutoFillEmptyCells = false;
dataTable.Padding = 1;
dataTable.SpaceInsideCell = 1;
dataTable.WidthPercentage = 100;
dataTable.Convert2pdfptable = true;
dataTable.TableFitsPage = true;
//=============Adding 01 Row==================
iTextSharp.text.Image img = iTextSharp.text.Image.GetInstance("images/LOGO4.GIF");
iTextSharp.text.Image address = iTextSharp.text.Image.GetInstance("images/address3.GIF");
Cell logo = new Cell(img);
dataTable.AddCell(logo);
Cell addres = new Cell(address);
dataTable.AddCell(addres);
...
尽管我阅读了一些相关的 post 和文章,但仍无法解决。
您可能正在使用旧版本的已弃用库版本(Table 已被 PdfPTable) (iTextSharp/iText 5 has been deprecated in favor of iText 7, which has the exact same license model). In any case, you can check out documentation about tables for iTextSharp/iText 5 here and here. For iText 7, you can find similar documentation here and here 取代(不幸的是,这些都是 Java 示例,但 API 几乎是一样的)。