Foros del Web » Programando para Internet » ASP Clásico »

FPDF - table.ext

Estas en el tema de FPDF - table.ext en el foro de ASP Clásico en Foros del Web. 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, ...
  #1 (permalink)  
Antiguo 05/09/2007, 02:34
 
Fecha de Ingreso: septiembre-2007
Mensajes: 2
Antigüedad: 17 años, 7 meses
Puntos: 0
FPDF - table.ext

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.
  #2 (permalink)  
Antiguo 05/09/2007, 10:42
Avatar de Myakire
Colaborador
 
Fecha de Ingreso: enero-2002
Ubicación: Centro de la república
Mensajes: 8.849
Antigüedad: 23 años, 3 meses
Puntos: 146
Re: FPDF - table.ext

Surely if u_goldman responded you, you would understand more, because he lives in the USA, but I will try it.

I don't know where you obtained the code of fpdf, but if you have doubts if it's the last version, you can download it of this site.

Your code is fine to me, may be you should try to read this link
  #3 (permalink)  
Antiguo 05/09/2007, 21:19
Avatar de u_goldman
Moderador
 
Fecha de Ingreso: enero-2002
Mensajes: 8.031
Antigüedad: 23 años, 3 meses
Puntos: 98
Re: FPDF - table.ext

Pues yo te entendí perfectamente my friend, seguramente los links provistos le ayudarán en su misión, además que yo no tengo experiencia alguna con fpdf, de hecho ni había entrado a este post pues vi que ya lo habías respondido.

Saludos
__________________
"El hombre que ha empezado a vivir seriamente por dentro, empieza a vivir más sencillamente por fuera."
-- Ernest Hemingway
  #4 (permalink)  
Antiguo 06/09/2007, 07:14
Avatar de Myakire
Colaborador
 
Fecha de Ingreso: enero-2002
Ubicación: Centro de la república
Mensajes: 8.849
Antigüedad: 23 años, 3 meses
Puntos: 146
Re: FPDF - table.ext

bonito moderador!!



Saludos

PD. Mi inglés es algo de lo que no me enorgullezco , pero menos mal que me entienden, jejeje
  #5 (permalink)  
Antiguo 07/09/2007, 07:24
Avatar de azulón  
Fecha de Ingreso: septiembre-2007
Mensajes: 1
Antigüedad: 17 años, 7 meses
Puntos: 0
Re: FPDF - table.ext

Hola, estoy empezando a usar el FPDF y tuve el mismo problema... A ver si lo puedo poner en inglés...

I've just test the same extension and got the same error. I think that there is a problem with the functions 'GetFontName()' and 'GetFontSize()' in the extension code... don't know why (I'm new to this FPDF).
A workaround: comment the 'if' statement dated on 9/29/2005 5:44PM and then the table is displayed.
With this, 'SetStyle' won't work, but you can set the font style using 'SetFont' in your page. Hope this could help you. (It work for me.)

¿Se entendió? Ojalá alguien pueda redactarlo mejor.

Saludos
  #6 (permalink)  
Antiguo 10/09/2007, 03:34
 
Fecha de Ingreso: septiembre-2007
Mensajes: 2
Antigüedad: 17 años, 7 meses
Puntos: 0
Re: FPDF - table.ext

Thank You a lot & a lot & a lot...!!!: You are very very kind: it's true, now something works.

Anyway, there're some imperfections (for ex. 'function footer' doesn't work at the last page): it seems impossible to me that nobody hasn't test it yet, and hasn't really the 'last' (good) version of 'table.ext': maybe we're discovering the warm water, but...
Thank You again. Bye bye.
Maria.
  #7 (permalink)  
Antiguo 10/09/2007, 07:37
Avatar de Myakire
Colaborador
 
Fecha de Ingreso: enero-2002
Ubicación: Centro de la república
Mensajes: 8.849
Antigüedad: 23 años, 3 meses
Puntos: 146
Re: FPDF - table.ext

If you want my files of fpdf (works fine), give me by private message your email account and i'll send you

Saludos!!
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 20:22.