Print Page | Close Window

Set text color for Table not working

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=3651
Printed Date: 27 Apr 24 at 8:58PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Set text color for Table not working
Posted By: cprins
Subject: Set text color for Table not working
Date Posted: 14 Dec 18 at 12:55PM
Hello,

I'm creating a table and I want to set the color of the first row to Blue with a White text
The other rows have a white background and a black text color
As soon as I set the text color to any value the text becoms invisible.

what is it that I'm doing wrong

 TableID:=pdf.qp.CreateTable(2, 4);
 pdf.QP.SetTableRowHeight(tableID, 1, 2, 5);
 pdf.QP.SetTableColumnWidth(tableID, 1, 1, 50);
 pdf.QP.SetTableColumnWidth(tableID, 2, 2, 100);
 pdf.QP.SetTableColumnWidth(tableID, 3, 4, 30);
 pdf.QP.SetTableCellBackgroundColor(tableID, 1, 1, 1, 4, 0.188, 0.329, 0.588);
 pdf.QP.SetTableCellAlignment(tableID, 1, 1, 1, 4, 4);
 pdf.QP.SetTableCellTextColor(TableID,1,1,2,4,0.9,0.9,0);
 pdf.QP.SetTableCellContent(tableID, 1, 1,'RegCode');
 pdf.QP.SetTableCellContent(tableID, 1, 2,'Omschrijving');
 pdf.QP.SetTableCellContent(tableID, 1, 3,'Van Datum');
 pdf.QP.SetTableCellContent(tableID, 1, 4,'Tot Datum');

 pdf.QP.SetTableCellContent(tableID, 2, 1,'024N300 00 02');
 pdf.QP.SetTableCellContent(tableID, 2, 2,'Temp.en rel.vocht logger');
 pdf.QP.SetTableCellContent(tableID, 2, 3,FormatDateTime('yyyy-mm-dd',now));
 pdf.QP.SetTableCellContent(tableID, 2, 4,'Tot Datum');



Replies:
Posted By: Ingo
Date Posted: 14 Dec 18 at 7:50PM
Hi CPrins,

don't have any experiences with table creation in pdf-documents.
Play a bit with the values you're using.
The B-value 0 seems a bit strange regarding the format of the other values.
Try it with the same format (x.xxx) like you're using for the background color...

Cheers and welcome here,
Ingo



-------------
Cheers,
Ingo



Posted By: mLipok
Date Posted: 24 Dec 18 at 11:08AM
Using:
pdf.QP.SetTableCellContent
focus on last parameter remember this is HTMLText
You could use:
'<font color="#FF0000">ANY TEXT</font>'
instead 'ANY TEXT'


-------------
Here you can find description how to test my examples:
http://www.quickpdf.org/forum/forum_posts.asp?TID=2932&PID=12600&title=drawcapturedpagematrix-matrix-howto#12600


Posted By: mLipok
Date Posted: 24 Dec 18 at 11:33AM

; create table and setting all parameters
Local $iTableID = $oQP.CreateTable(5, 4); 5 rows 4 columns
$oQP.SetTableColumnWidth($iTableID, 1, 1, 10);
$oQP.SetTableColumnWidth($iTableID, 2, 2, 30);
$oQP.SetTableColumnWidth($iTableID, 3, 4, 70);
$oQP.SetTableRowHeight($iTableID, 1, 5, 0);
$oQP.SetTableCellPadding($iTableID, 1, 1, 5, 4, $__eQPDF_BORDERINDEX_All, 1);
$oQP.SetTableCellBackgroundColor($iTableID, 1, 1, 1, 4, 3, 10, 0);
$oQP.SetTableCellBackgroundColor($iTableID, 2, 1, 5, 4, 0, 10, 3);
$oQP.SetTableCellBorderColor($iTableID, 1, 1, 5, 4, 0, 1, 0, 2);
$oQP.SetTableCellBorderWidth($iTableID, 1, 1, 5, 4, $__eQPDF_BORDERINDEX_Top, 0.1);
$oQP.SetTableCellBorderWidth($iTableID, 1, 1, 5, 4, $__eQPDF_BORDERINDEX_Left, 0.1);
$oQP.SetTableCellBorderWidth($iTableID, 1, 4, 5, 4, $__eQPDF_BORDERINDEX_Right, 0.1);
$oQP.SetTableCellBorderWidth($iTableID, 5, 4, 5, 4, $__eQPDF_BORDERINDEX_Bottom, 0.1);
$oQP.SetTableCellAlignment($iTableID, 1, 1, 5, 1, $__eQPDF_CELLALIGNMENT_MiddleCenter);
$oQP.SetTableCellTextSize($iTableID, 1, 1, 5, 1, 20);

; fill a table with the contents of an array variable
; used the $ sSufix is to show how changes in a table format, in the case of variable-length text inserted into the table.
Local $sSufix = ''
For $iRow = 0 To UBound($aTable, 1) - 1
For $iCol = 0 To UBound($aTable, 2) - 1
If $iCol > 1 And $iRow > 0 Then
$sSufix = ' ' & _StringRepeat('<br>' & $aTable[$iRow][1], $iRow)
Else
$sSufix = ''
EndIf
$oQP.SetTableCellContent($iTableID, $iRow + 1, $iCol + 1, $aTable[$iRow][$iCol] & $sSufix)
Next
Next
$oQP.SetTableCellTextColor($iTableID,2,2,UBound($aTable, 1) - 1,UBound($aTable, 2) - 1,0.9,0.9,0)

; finally draw the entire table in the document
$oQP.DrawTableRows($iTableID, 20, 10, 200, 1, 0)




-------------
Here you can find description how to test my examples:
http://www.quickpdf.org/forum/forum_posts.asp?TID=2932&PID=12600&title=drawcapturedpagematrix-matrix-howto#12600


Posted By: mLipok
Date Posted: 24 Dec 18 at 11:40AM
I think that you should firstly set content and at the end use: QP.SetTableCellTextColor



-------------
Here you can find description how to test my examples:
http://www.quickpdf.org/forum/forum_posts.asp?TID=2932&PID=12600&title=drawcapturedpagematrix-matrix-howto#12600



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