Hi !!
I'm getting problems testing FPDF extension 'table.ext':
someone can help me, kindly, please?
------------------------------------------------------------------------------------------------
this is 'table.ext's coding:
------------------------------------------------------------------------------------------------
var widths, borders, bordersW, bordersC, aligns, styles, fills;
this.borders = new Array();
this.aligns = new Array();
this.styles = new Array();
this.fills = new Array();
this.bordersW = new Array();
this.bordersC = new Array();
//Propriedades/Properties
this.Table = {Border:{Width:0.0,Color:''},Fill:{Color:''},TextA lign:"J", TextValign:"U", LineH:5}
this.SetColumns=function(){this.widths=arguments;}
//Adicionado por: Eduardo Gonçalves <
[email protected]>, 9/27/2005 10:54AM
this.SetBorders=function(){this.borders=arguments; } //Set 1,0 or B,T,L,R
this.SetAligns=function(){this.aligns=arguments;} //Set C,L,R,J
this.SetStyles=function(){this.styles=arguments;} //Set B,I,U of the Column
this.SetFills=function(){this.fills=arguments;} //BackGround of the Column
this.SetBordersW=function(){this.bordersW=argument s;} //Border Width
this.SetBordersC=function(){this.bordersC=argument s;} //Borders Color
this.HexToRGB=function(value){
var ar=new Array()
s= new String(value.toUpperCase());
ar["R"] = parseInt(s.substring(0,2),16);
ar["G"] = parseInt(s.substring(2,4),16);
ar["B"] = parseInt(s.substring(4,6),16);
return ar;
}
this.Row=function()
{
var xdata = arguments;
var xi, xh, xnb, xnbmax, xw;
var sumBorder=0;
var xwSumMultiCell=0;
var lastxw=0;
var xb = ""; //Border of the especific cell
var nxb = ""; //New Border of the Cell
xnbmax=0;
xnb=0;
//Número máximo de Linhas / Maximum number of Lines
for(xi=0;xi<xdata.length;xi++){ xnbmax=Math.max(xnbmax,this.NbLines(this.widths[xi],xdata[xi])); }
xh=(xnbmax)*this.Table.LineH; //Alterado por Eduardo Gonçalves
this.CheckPageBreak(xh);
//-----Inicio/Start-----------------------------
//Colunas/Columns
for(xi=0;xi<xdata.length;xi++)
{
xw=this.widths[xi];
xx=this.GetX();
xy=this.GetY();
//Pega a primeira posição do Y
//Get the First Position of the Y
if(xi==0){ var firstY=this.GetY(); }
//Adicionado por: Eduardo Gonçalves <
[email protected]>, 9/27/2005 10:54AM
if(this.borders[xi] == undefined){ xb=0; }
else{
xb=((this.borders[xi]!='')?this.borders[xi]:0);
}
//Adicionado por: Eduardo Gonçalves <
[email protected]>, 9/29/2005 3:50PM
if(this.aligns[xi] == undefined){ xalign=this.Table.TextAlign; }
else{
xalign=((this.aligns[xi].length>0)?this.aligns[xi]:this.Table.TextAlign);
}
//Adicionado por: Eduardo Gonçalves <
[email protected]>, 9/29/2005 5:44PM
if(this.styles[xi] == undefined){
this.SetFont(''+this.GetFontName()+'','',''+this.G etFontSize()+'');
}
else{
xsStyle=((this.styles[xi].length>0)?this.styles[xi]:'');
this.SetFont(''+this.GetFontName()+'',''+xsStyle+' ',''+this.GetFontSize()+'');
}
//Numero de linhas especificamente de uma coluna
xnb=this.NbLines(this.widths[xi],xdata[xi])
if (this.Table.Border.Width>0||this.Table.Fill.Color! =''){
var xstyle='';
this.SetLineWidth(this.Table.Border.Width);
if(this.Table.Border.Color!=''){
var RGB = this.HexToRGB(this.Table.Border.Color);
this.SetDrawColor(RGB["R"],RGB["G"],RGB["B"]);
xstyle+='D';
}
if(this.Table.Fill.Color!=''){
var RGB = this.HexToRGB(this.Table.Fill.Color);
this.SetFillColor(RGB["R"],RGB["G"],RGB["B"]);
xstyle+="F"
}
this.Rect(xx,firstY,xw,xh,xstyle); //Set the backgroud of the cell
}
//Adicionado por: Eduardo Gonçalves <
[email protected]>, 10/3/2005 5:14PM
if(this.bordersW[xi] != undefined){
this.SetLineWidth(this.bordersW[xi]);
}
this.SetDrawColor(0); //Default black
if(this.bordersC[xi] != undefined && this.bordersC[xi] !=''){
var RGB = this.HexToRGB(this.bordersC[xi]);
this.SetDrawColor(RGB["R"],RGB["G"],RGB["B"]);
}
//Adicionado por: Eduardo Gonçalves <
[email protected]>, 10/3/2005 5:14PM
if(this.fills[xi] != undefined){
if(this.fills[xi].length>0){
var RGB = this.HexToRGB(this.fills[xi]);
this.SetFillColor(RGB["R"],RGB["G"],RGB["B"]);
}
this.Rect(xx,firstY,xw,xh,"F"); //Set the backgroud of the cell
}
//Next 3 lines set vertical alignment
if(this.Table.TextValign=="B"){this.SetXY(xx,xy+(( xnbmax-xnb)*this.Table.LineH))};
else if(this.Table.TextValign=="M"){this.SetXY(xx,xy+(( xnbmax-xnb)*this.Table.LineH/2))};
else{ this.SetXY(xx,firstY); }
nxb = xb;
if(xnb<xnbmax){
//{Begin - To controle of the Borders - MultiCell }
if(xb.toString()==1){ nxb="LRT"; }
if(xb.toString().indexOf("B")>-1){ nxb=lib.str_replace("B","",xb);}
//{End - To controle of the Borders - MultiCell }
}
//************************************************** ********
//*************** Principal/Main **************************
this.MultiCell(xw,this.Table.LineH,xdata[xi],nxb,xalign);
//*************** END *************************
//************************************************** ********
if(xi==0){ xwSumMultiCell=0; }else{ xwSumMultiCell+=lastxw; }
if(xnb<xnbmax){
var iCount = (xnbmax-xnb);
var yhSumCell = this.Table.LineH;
for(i2=0; i2<iCount; i2++){
//{Begin - To controle of the Borders - Cell }
if((i2+1)==iCount){
if(xb.toString()==1){ nxb="LRB"; }else{ nxb=xb;}
if(xb.toString().indexOf("T")>-1){ nxb=lib.str_replace("T","",xb);}
}
else{
if(xb.toString()==1){ nxb="LR"; }
if(xb.toString().indexOf("B")>-1){ nxb=lib.str_replace("B","",xb);}
if(nxb.toString().indexOf("T")>-1){ nxb=lib.str_replace("T","",nxb);}
}
//{End - To controle of the Borders - Cell }
this.SetXY((this.GetX()+xwSumMultiCell), firstY+yhSumCell)
this.Cell(xw, this.Table.LineH, "", nxb, 1);
//DEBUG -> this.Cell(xw, this.Table.LineH, "{"+this.GetX()+"+"+xwSumMultiCell+"="+(this.GetX( )+xwSumMultiCell)+"}", 1, 1);
yhSumCell+=this.Table.LineH;
}//for(i2=0; i2<iCount; i2++){
}//if(xnb<xnbmax){
this.SetXY(xx+xw,firstY);
lastxw = xw; //Ultimo xw
}
//Colunas/Columns
//-----Fim/End-----------------------------
//Insere a nova linha da tabela
this.Ln(xh);
}//Fim do Row / End of the Row
//--------
this.CheckPageBreak=function(xh)
{
if(this.GetY()+xh>this.PageBreakTrigger)this.AddPa ge(this.CurOrientation);
}
//Calcula número de linhas / It calculates line number
this.NbLines=function(xw , xtxt)
{
var xnb=0;
var xwmax=0;
xcw=this.CurrentFont["cw"];
if(xw==0)xw=this.w-(this.rMargin)-this.x;
xwmax=((xw)-2*(this.cMargin))*1000/(this.FontSize);
xs=lib.str_replace("\r","",xtxt);
xnb=xs.length;
if(xnb>0 && xs.charAt(xnb-1)=="\n")xnb--;
xsep=-1;
xi=0;
xj=0;
xl=0;
xnl=1;
while(xi<xnb)
{
xc=xs.charAt(xi);
if(xc=="\n")
{
xi++;
xsep=-1;
xj=xi;
xl=0;
xnl++;
continue;
}
if(xc==" ")xsep=xi;
xl+=(xcw[xc]);
if(xl>xwmax)
{
if(xsep==-1)
{
if(xi==xj)xi++;
}
else xi=xsep+1;
xsep=-1;
xj=xi;
xl=0;
xnl++;
}
else {xi++;}
}
return xnl;
}
//Função que auto-completa espaços na coluna
//Auto-complete function that spaces in the column
this.completeData=function(strData, imaxnb, icellw){
var fim="n";
var imax=0;
while(fim=="n"){
imax=Math.max(imax,this.NbLines(icellw,strData));
strData+=" ";
if(imaxnb==imax){ fim="s"; }
}
return strData;
}
---------------------------------------------------------------------------------------------------
this is the stupid pgm:
---------------------------------------------------------------------------------------------------
<%@language=vbscript%>
<!--#include file="db/fpdf/fpdf.asp"-->
<%
' esempio di tabella imbecille .......
Dim pdf
Set pdf=CreateJsObject("FPDF")
pdf.CreatePDF()
pdf.SetPath("db/fpdf/") 'il path è ok
pdf.LoadExtension("table")
pdf.Open()
pdf.AddPage()
pdf.SetFont "Arial","",10
pdf.SetColumns 150
pdf.Table.Fill.Color="C0C0C0"
pdf.Table.TextAlign = "J"
pdf.Table.Border.Width=1
'//Auto Break
pdf.Row "here it comes the text, aqui vem o texto. here it comes the text, aqui vem o texto. here it comes the text, aqui vem o texto. here it comes the text, aqui vem o texto. "
'//Table with two columns
pdf.SetColumns 50, 50
pdf.Table.TextAlign = "J"
pdf.Table.Border.Width=0.4
pdf.Table.Border.Color="000000"
pdf.Table.Fill.Color="8FB7CF"
pdf.Row "Linea 1 - Colonna 1", "Linea 1 - Colonna 2"
pdf.Close()
pdf.Output "test.pdf",1,1
%>
--------------------------------------------------------------------------------------------------
and this is the error, without any specification of line's number...
--------------------------------------------------------------------------------------------------
HTTP 500.100 - Errore interno del server - errore ASP
Internet Information Services
Informazioni tecniche (per il personale del supporto tecnico)
* Tipo di errore:
Errore di run-time di Microsoft JScript (0x800A01B6)
Proprietà o metodo non supportati dall'oggetto
/web/maria/ddd.asp
* Tipo di browser:
Mozilla/5.0 (Windows; U; Windows NT 5.1; it; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6
-------------------------------------------------------------------------------------------------
I've no experience in Asp etc.!
Maybe there's another more recent version of 'table.ext'. Who knows?
Thank you in advance.
Maria.