Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!
Setting table column widths to accomodate contents |
Post Reply |
Author | |
Dave K
Beginner Joined: 03 May 19 Location: Torquay Status: Offline Points: 4 |
Post Options
Thanks(0)
Posted: 03 May 19 at 3:28PM |
Hello, I am new to Debenu quick pdf library. I am writing software for my company that involves extracting data from Excel files and ultimately producing PDF documents that among other contents contain tabular data. At first I was thinking that I would have to be writing strings of text out on to a page and manually drawing the table cells... Then I found out about using tables built into the library... If I create a table with several columns and then populate the cells with strings of various lengths, is there a built in way to set the column widths to accommodate the longest width needed for a cell in that column? Or must I first iterate over the strings and use e.g. GetHTMLTextWidth() to find the longest before creating the table? Or is it recommended to set the column widths using SetTableColumnWidth() dynamically as the data is added - using the longest so far measured value?
|
|
Ingo
Moderator Group Joined: 29 Oct 05 Status: Offline Points: 3524 |
Post Options
Thanks(0)
|
Hi Dave,
After using DrawHTMLText... https://www.debenu.com/docs/pdf_library_reference/DrawHTMLText.php ...you can use GetHTMLTextWidth... https://www.debenu.com/docs/pdf_library_reference/GetHTMLTextWidth.php ...toget the width of the textstring you've actually drawn. I think you've already found the Debenu-online-ressources for the first steps, developer guide, samples and so on? Cheers and welcome here, Ingo |
|
Cheers,
Ingo |
|
Dave K
Beginner Joined: 03 May 19 Location: Torquay Status: Offline Points: 4 |
Post Options
Thanks(0)
|
Hi Ingo, Thanks, the procedure you're outlining there is pretty much how I was originally thinking it would work. But then I saw the functions CreateTable(), SetTableCellContent() and DrawTableRows() etc. I can see how I can use these table handling functions to create tables in an efficient way- but only if the cell sizes are known before hand. It just seemed like I must be missing something if that's the only way these functions work. Is there a way of using the table functions in such a way so that the library computes the required cell sizes as the data is added to the table using SetTableCellContent etc? Or is the only way to do it that I collect all of the data before hand and determine the required sizes before creating the table? It seemed to me that if tables had been added to the library as an object for convenience then it is likely the table could auto fit to the data that's added to it - and I'm just missing the information on how to use it that way? I do have the developer guide and reference but I couldn't find much in those to do with the intended collective use of the table functions. I will eventually get to the point where I can experiment with how to do this properly - but I was just hoping that its common knowledge already.
|
|
Ingo
Moderator Group Joined: 29 Oct 05 Status: Offline Points: 3524 |
Post Options
Thanks(0)
|
Hi Dave,
the cell denitions are fix. What you can do is making the text floating ;-) |
|
Cheers,
Ingo |
|
Dave K
Beginner Joined: 03 May 19 Location: Torquay Status: Offline Points: 4 |
Post Options
Thanks(0)
|
Hi Ingo, I'm not quite sure what your intended meaning is for that. But thanks for your help anyway ;-)
|
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |
Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. About — Contact — Blog — Support — Online Store