Free Support Forum -

Adding a total line

We have purchased Aspose PDF tool to generate PDF reports. I am trying to generate a regular bill of PDF report, I have a table in the section which is contains charges, taxes, govt fee. This table have no border. I need to insert a line in the table cell just before Total.

Please help us to acheive this and have a look on below code.

Cell cell4Row2=row2.getCells().add("1000.25");


cell4Row2.setBorder(new BorderInfo(BorderSide.Bottom.getValue(),1F, new aspose.pdf.Color("red")));

Hello Rama,

Thanks for using our products.

Do you mean to accomplish something as specified in attached PDF document ? if so is the case, please try using the following code snippet. In case I have not properly understood your requirement, please share some more details. If possible, please share a snapshot that can help us in understanding your requirement.


// create PDF object
Pdf pdf = new Pdf();
// create section object and add it to sections collection of pdf
Section sec = pdf.getSections().add();

//Instantiate a table object
Table table = new Table(sec);
//Add the table in paragraphs collection of the desired section
//Set with column widths of the table
table.setColumnWidths("50 50 50");
//Set default cell border using BorderInfo object
table.setDefaultCellBorder(new BorderInfo(BorderSide.All.getValue(), 0.0f));
//Set Outer table border using another customized BorderInfo object.
table.setBorder(new BorderInfo(BorderSide.All.getValue(), 0.5f, new Color("Red")));
//Set the MarginInfo for table object
table.getMargin().Top = 5;
table.getMargin().Bottom = 5;
table.getMargin().Left = 5;
table.getMargin().Right = 5;

for (int counter = 0; counter <= 10; counter++)
//Create rows in the table and then cells in the rows
Row row1 = table.getRows().add();

Row row2 = table.getRows().add();
row2.setBorder(new BorderInfo(BorderSide.Top.getValue(), 0.5f));
// add table to paragraphs collection of section object
// save the resultant PDF"d:/pdftest/TableBorder_Test.pdf");