Print Page | Close Window

GetTableCellDblProperty

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: General Discussion
Forum Description: Discussion board for Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=3133
Printed Date: 22 Nov 24 at 11:02PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: GetTableCellDblProperty
Posted By: mdgodfrey
Subject: GetTableCellDblProperty
Date Posted: 10 Jun 15 at 6:54PM
I am trying to draw a checkbox (unicode character $2610 or $2611) into a table cell.

I originally tried using SetTableCellContent but can't seem to find a way to get the HTML to work.
So my latest attempt is to use GetTableCellDblProperty using Tag 101 & 102 to get the Left and Top of the cell.

Left wants to return 0. Not helpful since the cell is in the middle of the page.
Top wants to return a 279.8 which is at the bottom of the page.
Either way niether Left of Top return a value that is where the cell is.
Is that what it is intended to do?

Any suggestions at this point will be greatly appreciated.






Replies:
Posted By: Rowan
Date Posted: 24 Jun 15 at 12:39PM
Hi mdgodfrey,

Yes, it looks like there's an issue there. I'm seeing some unhelpful results on my end. I see one of my colleagues has already lodged a case for this in the bug tracker, I'll bump up the priority.

Cheers,
- Rowan.


Posted By: Rowan
Date Posted: 24 Jun 15 at 3:38PM
Actually, turns out it is not a bug, but unclear documentation. The GetTableCellDblProperty function needs to be called after the DrawTableRows function when you want to get the Left/Top/Width/Height values. All of the other returned values should return correctly if GetTableCellDblProperty earlier in the code. Doing that will give you the results you expect. We will update the function reference to make this clearer. Apologies for the confusion.

Here's some sample code:

// Set the page size of the new document

DPL.SetPageSize("Letter");

// Create the table and specify the number of rows and columns

int tableID = DPL.CreateTable(5, 5);

// Specify color and width of borders   

DPL.SetTableBorderColor(tableID, 0, 0.3, 0.204, 0);
DPL.SetTableBorderWidth(tableID, 0, 0.2);

// Specify table row height and table column width

DPL.SetTableRowHeight(tableID, 1, 5, 0);
DPL.SetTableColumnWidth(tableID, 1, 5, 100);

// Specify a background color for the column headers

DPL.SetTableCellBackgroundColor(tableID, 1, 1, 1, 5, 0.3, 0.7, 1.0);
DPL.SetTableCellAlignment(tableID, 1, 1, 1, 5, 4);

// Setup the column headers and content for the first row

DPL.SetTableCellContent(tableID, 1, 1, "<b>This Week</b>");
DPL.SetTableCellContent(tableID, 1, 2, "<b>Last Week</b>");
DPL.SetTableCellContent(tableID, 1, 3, "<b>Artist Name</b>");
DPL.SetTableCellContent(tableID, 1, 4, "<b>Peak</b>");
DPL.SetTableCellContent(tableID, 1, 5, "<b>Weeks On</b>");

// Insert the content for the second row

DPL.SetTableCellContent(tableID, 2, 1, "1");
DPL.SetTableCellContent(tableID, 2, 2, "1");
DPL.SetTableCellContent(tableID, 2, 3, "<b>The Black Eyed Peas</b><br>Boom Boom Pow");
DPL.SetTableCellContent(tableID, 2, 4, "<b>1</b>");
DPL.SetTableCellContent(tableID, 2, 5, "<b>11</b>");

// Insert the content for the third row

DPL.SetTableCellContent(tableID, 3, 1, "2");
DPL.SetTableCellContent(tableID, 3, 2, "3");
DPL.SetTableCellContent(tableID, 3, 3, "<b>Missy Higgins</b><br>Life is a rainbow");
DPL.SetTableCellContent(tableID, 3, 4, "<b>2</b>");
DPL.SetTableCellContent(tableID, 3, 5, "<b>8</b>");

// Insert the content for the fourth row

DPL.SetTableCellContent(tableID, 4, 1, "3");
DPL.SetTableCellContent(tableID, 4, 2, "2");
DPL.SetTableCellContent(tableID, 4, 3, "<b>Silverchair</b><br>The Door");
DPL.SetTableCellContent(tableID, 4, 4, "<b>3</b>");
DPL.SetTableCellContent(tableID, 4, 5, "<b>7</b>");

// Insert the content for the fourth row

DPL.SetTableCellContent(tableID, 5, 1, "4");
DPL.SetTableCellContent(tableID, 5, 2, "4");
DPL.SetTableCellContent(tableID, 5, 3, "<b>Rolling Stones</b><br>Sweet Virginia");
DPL.SetTableCellContent(tableID, 5, 4, "<b>4</b>");
DPL.SetTableCellContent(tableID, 5, 5, "<b>19</b>");

// Draw the table onto the document

DPL.SetOrigin(1);
DPL.DrawTableRows(tableID, 50, 50, 400, 1, 0);

double cellPosLeft = DPL.GetTableCellDblProperty(tableID, 5, 1, 101);
double cellPosTop = DPL.GetTableCellDblProperty(tableID, 5, 1, 102);
double cellPosWidth = DPL.GetTableCellDblProperty(tableID, 5, 1, 103);
double cellPosHeight = DPL.GetTableCellDblProperty(tableID, 5, 1, 104);

Console.WriteLine("Left: " + Convert.ToString(cellPosLeft));
Console.WriteLine("Top: " + Convert.ToString(cellPosTop));
Console.WriteLine("Height: " + Convert.ToString(cellPosHeight));
Console.WriteLine("Width: " + Convert.ToString(cellPosWidth));

// Save the document to disk
DPL.SaveToFile("table.pdf");


Posted By: mdgodfrey
Date Posted: 24 Jun 15 at 4:56PM
That helps.

Thanks!



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk