I have a business case where in a table with FIXED WIDTH columns, some specific content needs to extend beyond the page margins. I was able to accomplish this with the “.UseAllAvailableWidth()” method. However, the issue that I am now having, is that these nested tables are encapsulated in a “Cell” object, which is supposed to have a border. While the table and content inside are extending beyond the page margin as they should, the drawn border of the outer cell itself that is holding these objects DOES NOT…and ends directly at the margin. How can I ensure that the border of the cell will match the actual overall cell size? Image of the current problem:
For reference, the document, it’s overall size, and it’s page margins and created and set like so: //create FileStream for the file using (FileStream fs = new FileStream(tmppath, FileMode.Create)) {
//get an instance of a PdfWriter, attached to the FileStream
PdfWriter w = new PdfWriter(fs);
//create new PdfDocument object
PdfDocument pd = new PdfDocument(w);
PageSize psize = new PageSize(myFmt.ToFloat(mydr["doc_width"]),
myFmt.ToFloat(mydr["doc_height"]));
//create new Document object,
//passing in both the PdfDocument object, and PageSize objects
Document doc = new Document(pd, psize);
//set document margins
doc.SetMargins(myFmt.ToFloat(mydr["doc_margin_top"]),
myFmt.ToFloat(mydr["doc_margin_right"]),
myFmt.ToFloat(mydr["doc_margin_bottom"]),
myFmt.ToFloat(mydr["doc_margin_left"]));
Tables are created using the below method. Two tables are nested in a larger 2-column “master” table.
internal static Table CreateTable(float[] col_widths)
{
////////////////////////////////////////////////////////////////////////////////////
Table t = new Table(col_widths);
t.SetFixedLayout();
////start with a blank style
t.AddStyle(new Style());
t.SetBorder(Border.NO_BORDER);
t.UseAllAvailableWidth();
return t;
}
