Autore Topic: Report con PdfWriter  (Letto 21715 volte)

Offline Ceskho

  • Amministratore
  • Senatore Gambero
  • *****
  • Post: 3.778
  • Vi Veri Veniversum Vivus Vici
    • Mostra profilo
    • Pagina Personale
Re: Report con PdfWriter
« Risposta #15 il: 07 Maggio 2010, 02:44:32 »
@Ceskho
Grazie che mi hai sistemato il wiki.

Si, scusa se ho scritto qualche castroneria ma non ho mai usato il componente e perciò non lo conosco... ;)

Offline Golia

  • Senatore Gambero
  • ******
  • Post: 1.298
  • no xe mai massa tardi
    • Mostra profilo
Re: Report con PdfWriter
« Risposta #16 il: 12 Maggio 2010, 00:36:27 »
Grazie al pronto intervento di milio ho convertito l'esempio per Gambas3
Eccolo quà

Offline md9327

  • Moderatore
  • Senatore Gambero
  • *****
  • Post: 2.840
    • Mostra profilo
Re: Report con PdfWriter
« Risposta #17 il: 20 Agosto 2010, 16:43:58 »
Ho reintracciato questo thread, in modo da non crearne ulteriori inutilmente.

Oggi ho ridato un'occhiata alla libreria PdfWriter, anche spinto da una mail proveniente dall'altro capo del modo, nella quale mi si chiedevano ulteriori aggiornamenti.
E' passato un bel pò di tempo, e questa libreria, dato che non avevo al momento nessun scopo per aggiornarla, ma ora ho notato che quella da cui sono partito, FPDF, è passata di release.

Dato anche che, ultimamente, mi sono messo a sistemare classi e librerie che avevo creato, ma mai pubblicato, e che stò aggiornando anche il presente forum, con la pubblicazione di un certo numero di cose del genere, ho pensato che era pure il caso di riprendere in mano PdfWriter.

Per un certo tempo non sono stato molto presente nel sito, e cercando quà e là, ho ritrovato questo thread.
Ho dato una letta ai messaggi, e ho notato che c'è stato un pò di movimento sul codice della libreria. Non che questo mi dispiaccia, anzi, solo che mi piacerebbe conoscere le eventuali modifiche e implementazioni che sono fatte, in modo da poter aggiornare la libreria che è ufficialmente distribuita su sourceforge.net, così da rendere gli aggiornamenti disponibili anche a livello globale.

Ho notato anche con piacere che la libreria sul sito sourceforge è stata scaricata molte volte (700/800 downloads).

Insomma, mettendo mano agli ultimi sorgenti (versione 0.0.3), ho solo dato qualche ripulita, e ho impostato la libreria come un componente, in particolare aggiungendo un paio di eventi in sostituzione/parallelo ai due metodi Header e Footer.
In parole povere, ora è possibile creare oggetti derivati da PdfWriter, senza costruirli con INHERITS, ma gestendo i due eventi all'interno di altri classi (ad esempio una Form). Restano comunque attivi e validi, per questioni di compatibilità, i due metodi, consentendo di usare il sistema precedente.
L'introduzione degli eventi rende svincolato l'oggetto dal resto del codice applicativo.

Per finire, e sistemare la classe con eventuali features introdotte da Voi, mi aspetto gentilmente qualche spiegazione e che cosa è stato cambiato o implementato, così da integrarlo nella nuova versione.

Al momento la release pubblicata ufficla eè la 0.0.4.

Resto in attesa.

Un ciao e un grazie a tutti!  :2birre:

Offline Ceskho

  • Amministratore
  • Senatore Gambero
  • *****
  • Post: 3.778
  • Vi Veri Veniversum Vivus Vici
    • Mostra profilo
    • Pagina Personale
Re: Report con PdfWriter
« Risposta #18 il: 20 Agosto 2010, 18:26:39 »
Non puoi caricare pdfwriter su servizi come git o svn in modo che chi di noi vuole collaborare fa dei semplici commits e tutti ne usufruiscono?

Ultimamente grazie a dei progetti a cui lavoro ho scoperto la potenzialità enorme di questi strumenti e mi chiedo come ho fatto fino ad ora a non usarli......vaglia questa possibilità così avrai ta le mani sicuramente un arma a tuo favore.....my2cents.... ;)

Offline Golia

  • Senatore Gambero
  • ******
  • Post: 1.298
  • no xe mai massa tardi
    • Mostra profilo
Re: Report con PdfWriter
« Risposta #19 il: 21 Agosto 2010, 14:40:00 »
@md9327
Ciao, adesso sono in ferie, però non riuscendo a stare lontano dal forum mi sono trovato un'internet point. ;D

Ho apportato delle modifiche in tua assenza, quando vedrai il codice ti verrà da ridere...intanto mi sono arrangiato per quello che mi serviva ;)
Allora, intanto non riuscivo a fare andare il simbolo dell'euro, e ho risolto con un semplice replace (mi sembra almeno perchè adesso non ho il programma per vederlo).
Se scarichi l'esempio di questo 3d vedrai che ho aggiunto delle funzioni, "multiriga" che in accoppiata con "multirect" mi ha servito per creare una griglia con il testo che può andare a capo. Ho modificato (clonato) cell e multicell in quanto non riuscivo a creare la griglia come volevo. Forse non avevo capito come funziona multicell, comunque ho raggiunto il risultato che volevo.
Sono contento che riprendi in mano questa classe che considero fantastica e utilissima per chi deve creare report, io e Dex abbiamo anche provato a pubblicizzarla :D
Io torno tra 1 settimana e sono disponibile per chiarirti bene quello che ho implementato, e sarò comunque contento se sostituirai tu (o mi spiegherai se era già fatto :D) la funzione che ho fatto.
Ciao a presto


P.S. le funzioni che ho aggiunto sono in fondo alla classe
« Ultima modifica: 21 Agosto 2010, 14:42:12 da Golia »

Offline md9327

  • Moderatore
  • Senatore Gambero
  • *****
  • Post: 2.840
    • Mostra profilo
Re: Report con PdfWriter
« Risposta #20 il: 23 Agosto 2010, 13:27:14 »
Per cesko:
hai ragione, per pgDesigner l'ho fatto, ma per PdfWriter no. Mò ci penso e vedo di inserire la libreria sia svn, sempre su sf.net (visto che c'è, e funziona pure bene...).
Comunque, per qualsiasi cosa, il mio indirizzo è presente nei sorgenti, per cui basta inviarmi un email e collabora.

Ad ogni modo, quello che ho scritto mica era un rimprovero, ma dato che qualcuno aveva avuto qualche idea e implementato qualche funzione, mi pareva corretto e giusto sistemare la libreria con queste cose.
Aricomunque, ho visto che sul sito ufficiale di FPDF è uscita la versione 1.6. Non sò che cosa cambia, dovrei comfrontarla con la 1.53 da cui ho fatto il porting. Inoltre, avevo anche inserito molte funzionalità carine, mie, ma soprattutto portate da quelle pubblicate dagli utenti sul sito fpdf, tra cui se non ricordo male proprio la MultiCell.

Nella versione 0.0.4 era stata aggiunta anche una cosetta suggerita da un utente di sf.net, ma che poi non ha funzionato più nelle ultime release di Gambas2, per cui l'ho dovuta commentare, e relativa proprio ai conversione di caratteri NON UTF8. E' probabile che proprio questa cosa poteva risolvere il problema di Milio.

Per MilioSe mi dici dovè il codice, provo a valutarlo per inserirlo definitivamente nel pacchetto da pubblicare. ALtrimenti puoi indicarmi i soli pezzi inseriti e/o modificati.
Tieni però conto che prima devo valutare che siano modifiche non legate a specifiche tue esigenze del programma, perchè in quel caso non andrebbero egrale nella libreria.bene. Ad ogni modo, se sono corrette, posso anche vedere di modificarle in modo anonimo e integrarle nella liberia.
Fammi sapere.  :2birre:

Offline Golia

  • Senatore Gambero
  • ******
  • Post: 1.298
  • no xe mai massa tardi
    • Mostra profilo
Re: Report con PdfWriter
« Risposta #21 il: 25 Agosto 2010, 14:23:40 »
Ciao Md9327
Citazione
Per MilioSe mi dici dovè il codice..
Penso fosse rivolto am me :D
Se scarichi questo esempio che abbiamo fatto io e Dex,
http://www.gambas-it.org/smf/index.php?topic=1056.msg11752#msg11752
Trovi le funzioni aggiuntive in fondo al codice, inoltre c'è già pronto un esempio con sqlite3, il database è nella cartella dovrebbe funzionare senza che controlli niente (se hai installato sqlite3). Fammi sapere ciao

Offline md9327

  • Moderatore
  • Senatore Gambero
  • *****
  • Post: 2.840
    • Mostra profilo
Re: Report con PdfWriter
« Risposta #22 il: 25 Agosto 2010, 14:48:54 »
Perdona... Golia! Ho confuso i nick... sai, l'età... e combattere con cesko stresserebbe chiunque...  :P

Appena ho un attimo, vedo di capirci qualcosa... e ritorno qua... forse... mah, non sò... ma si, và... :-)

Scherzo! Ve ne parliamo! Bye

Offline Golia

  • Senatore Gambero
  • ******
  • Post: 1.298
  • no xe mai massa tardi
    • Mostra profilo
Re: Report con PdfWriter
« Risposta #23 il: 30 Agosto 2010, 23:07:55 »
@MD9327
Ciao, ho allegato l'immagine per farti vedere il risultato ottenuto con multiriga.
Se questo risultato si ottiene già con PdfWriter il discorso si può chiudere  :)
..a patto che mi spieghi  ;D , scherzo, fammi sapere ciao

Offline md9327

  • Moderatore
  • Senatore Gambero
  • *****
  • Post: 2.840
    • Mostra profilo
Re: Report con PdfWriter
« Risposta #24 il: 31 Agosto 2010, 10:36:29 »
Scusa, ma la cosa non veniva già fatta da multicell?
A meno che la separazione delle stringhe non debba seguire logiche particolari, come ho fatto in qualche mio progetto, multicell dovrebbe fare la stessa cosa... sbaglio? eventualmente quale problema dà?

P.S.: devo ancora andare a spulciare le differenze nella nuova FPDF... purtroppo il tempo e le occasioni sono poche...

Offline dex

  • Gran Maestro dei Gamberi
  • *****
  • Post: 872
    • Mostra profilo
Re: Report con PdfWriter
« Risposta #25 il: 31 Agosto 2010, 17:20:38 »
@md9327
si in effetti multicell faceva la stessa cosa ma una sola cella per riga, in pratica sulla stessa riga non si potevano mettere più celle e bisognava andare a capo.
A meno che non siamo riusciti a settare bene multicell.

Tienici aggiornati che pdfwriter ci interessa moltissimo.

Offline Golia

  • Senatore Gambero
  • ******
  • Post: 1.298
  • no xe mai massa tardi
    • Mostra profilo
Re: Report con PdfWriter
« Risposta #26 il: 31 Agosto 2010, 17:40:00 »
Citazione
si in effetti multicell faceva la stessa cosa ma una sola cella per riga, in pratica sulla stessa riga non si potevano mettere più celle e bisognava andare a capo.
A meno che non siamo riusciti a settare bene multicell
Esatto, inoltre se fosse possibile inserire più celle nella stessa riga, i rettangoli verrebbero con altezze diverse.
Come ha detto Dex siamo molto interessati a questa classe. Ciao grazie  :2birre:

Offline md9327

  • Moderatore
  • Senatore Gambero
  • *****
  • Post: 2.840
    • Mostra profilo
Re: Report con PdfWriter
« Risposta #27 il: 01 Settembre 2010, 11:35:16 »
Bè, ragazzi, sicuramente continuo a metterci mano, ma se avete la possibilità, di certo potete contribuire.

Credo che, se avete qualche modifica e/o implementazione, come ho pure scritto prima, basta che me lo dite.
Vedrò poi di cercare di attivare l'svn su sf.net, in modo che possiate inviare gli aggiornamenti direttamente nel repository, ma ad ogni modo poi dovrò comunque validarli.

Riguardo a MultiCell, in effetti non ricordo che ci fosse quel tipo di problema. In effetti io l'ho usato in modo controllato, ovvero praticamente usavo Cell e mi gestivo io il contenuto e il contorno... almeno per quanto mi ricordo...  :-\

Se avete codice da inviarmi, potete anche inviarmelo direttamente alla mia email.

Bye

Offline Golia

  • Senatore Gambero
  • ******
  • Post: 1.298
  • no xe mai massa tardi
    • Mostra profilo
Re: Report con PdfWriter
« Risposta #28 il: 02 Settembre 2010, 22:58:42 »
Ciao, ti riporto quello che ho aggiunto a PdfWrite qui sotto (clonando Cell e Multicell)

Codice: gambas [Seleziona]
PRIVATE $lasthmulti AS Integer


Codice: gambas [Seleziona]
PUBLIC SUB Cell2(w AS Float, OPTIONAL h AS Float = 0, OPTIONAL txt AS String = "", OPTIONAL border AS Variant = FALSE, OPTIONAL ln AS Integer = 0, OPTIONAL align AS String = "", OPTIONAL fill AS Boolean = FALSE, OPTIONAL slink AS String = "")
  DIM k, x, y, ws, dx, wmax, wlink AS Float
  DIM s, op, txt2 AS String
  'Output a cell
  k = $k

  IF (w = 0) THEN w = $w - $rMargin - $x
  s = ""
  IF (IsBoolean(border)) THEN
    IF (fill OR border) THEN
      op = IIf(fill, IIf(border, "B", "f"), "S")
      s = _stringFloat($x * k, "0.00") & " " &
          _stringFloat(($h - $y) * k, "0.00") & " " &
          _stringFloat(w * k, "0.00") & " " &
          _stringFloat(- h * k, "0.00") & " re " & op & " "
    END IF
  ELSE IF (IsString(border)) THEN
    x = $x
    y = $y
    IF (InStr(border, "L")) THEN
      s &= _stringFloat(x * k, "0.00") & " " &
           _stringFloat(($h - y) * k, "0.00") & " m " &
           _stringFloat(x * k, "0.00") & " " &
           _stringFloat(($h - (y + h)) * k, "0.00") & " l S "
    END IF
    IF (InStr(border, "T")) THEN
      s &= _stringFloat(x * k, "0.00") & " " &
           _stringFloat(($h - y) * k, "0.00") & " m " &
           _stringFloat((x + w) * k, "0.00") & " " &
           _stringFloat(($h - y) * k, "0.00") & " l S "
    END IF
    IF (InStr(border, "R")) THEN
      s &= _stringFloat((x + w) * k, "0.00") & " " &
           _stringFloat(($h - y) * k, "0.00") & " m " &
           _stringFloat((x + w) * k, "0.00") & " " &
           _stringFloat(($h - (y + h)) * k, "0.00") & " l S "
    END IF
    IF (InStr(border, "B")) THEN
      s &= _stringFloat(x * k, "0.00") & " " &
           _stringFloat(($h - (y + h)) * k, "0.00") & " m " &
           _stringFloat((x + w) * k, "0.00") & " " &
           _stringFloat(($h - (y + h)) * k, "0.00") & " l S "
    END IF
  END IF
  IF (txt <> "") THEN
    SELECT CASE align
    CASE "R"
      dx = w - $cMargin - ME.GetStringWidth(txt)
    CASE "C"
      dx = (w - ME.GetStringWidth(txt)) / 2
    CASE "FJ" 'Justify
      'Set word spacing
      wmax = (w - 2 * $cMargin)
      $ws = (wmax - ME.GetStringWidth(txt)) / (Split(txt, " ").Count - 1)
      _out(_stringFloat($ws * $k, "0.000") & " Tw")
      dx = $cMargin
    DEFAULT
      dx = $cMargin
    END SELECT
    IF ($ColorFlag) THEN s &= "q " & $TextColor & " "
    txt2 = Replace(Replace(Replace(txt, "\\", "\\\\"), "(", "\\("), ")", "\\)")

      txt2 = convcharacters(txt2)

    
    s &= "BT " & _stringFloat(($x + dx) * k, "0.00") & " " &
                 _stringFloat(($h - ($y + 0.5 * h + 0.3 * $FontSize)) * k, "0.00") & " Td (" & txt2 & ") Tj ET"
    IF ($underline) THEN s &= " " & _dounderline($x + dx, $y + 0.5 * h + 0.3 * $FontSize, txt)
    IF ($ColorFlag) THEN s &= " Q"
    'IF (slink) THEN ME.Link($x + dx, $y + 0.5 * h - 0.5 * $FontSize, ME.GetStringWidth(txt), $FontSize, slink)
    IF (slink) THEN
      IF (align = "FJ") THEN
        wlink = wmax
      ELSE
        wlink = ME.GetStringWidth(txt)
      END IF
      ME.Link($x + dx, $y + 0.5 * h - 0.5 * $FontSize, wlink, $FontSize, slink)
    END IF
  END IF
  IF (s) THEN _out(s)
  IF (align = "FJ") THEN
    'Remove word spacing
    _out("0 Tw")
    $ws = 0
  END IF
  $lasth = h
  IF (ln > 0) THEN
    'Go to next line
    $y += h
    IF (ln = 1) THEN $x = $lMargin
  ELSE
    $x += w
  END IF
END

PUBLIC SUB MultiRiga(w AS Float, h AS Float, txt AS String, OPTIONAL border AS Variant = FALSE, OPTIONAL align AS String = "J", OPTIONAL fill AS Boolean = FALSE)
  DIM cw AS Integer[]
  DIM wmax AS Float
  DIM s, b, b2, c AS String
  DIM nb, sep, i, j, l, ns, nl, ls AS Integer
  DIM numeroriga AS Integer
  DIM salva$y AS Integer
  DIM hriga AS Integer
  
  salva$y = $y
  numeroriga = 0
  'Output text with automatic or explicit line breaks
  cw = $CurrentFont["cw"]
  IF (w = 0) THEN w = $w - $rMargin - $x
  wmax = (w - 2 * $cMargin) * 1000 / $FontSize
  s = Replace(txt, "\r", "")
  nb = Len(s)
  IF (nb > 0) AND IF (Mid(s, nb, 1) = "\n") THEN DEC nb
  b = 0
  IF (IsBoolean(border) OR IsInteger(border)) THEN
    IF (border) THEN
      border = "LTRB"
      b = "LRT"
      b2 = "LR"
    END IF
  ELSE IF (IsString(border)) THEN
    b2 = ""
    IF (InStr(border, "L")) THEN b2 &= "L"
    IF (InStr(border, "R")) THEN b2 &= "R"
    b = IIf(InStr(border, "T"), b2 & "T", b2)
  END IF
  sep = -1
  i = 1
  j = 1
  l = 0
  ns = 0
  nl = 1
  WHILE (i <= nb)
 
    'Get next character
    c = Mid(s, i, 1)
    IF (c = "\n") THEN
      'Explicit line break
      IF ($ws > 0) THEN
        $ws = 0
        _out("0 Tw")
      END IF
      numeroriga += 1
      ME.Cell2(w, h, Mid(s, j, i - j), b, 2, align, fill)
      INC i
      sep = -1
      j = i
      l = 0
      ns = 0
      INC nl
      IF (IsBoolean(border) OR IsInteger(border)) THEN
        IF (border AND nl = 2) THEN b = b2
      ELSE IF (IsString(border)) THEN
        IF (NOT IsNull(border) AND nl = 2) THEN b = b2
      END IF
      CONTINUE
    END IF
    IF (c = " ") THEN
      sep = i
      ls = l
      INC ns
    END IF
    l += cw[Asc(c)]
    IF (l > wmax) THEN
      'Automatic line break
      IF (sep = -1) THEN
        IF (i = j) THEN INC i
        IF ($ws > 0) THEN
          $ws = 0
          _out("0 Tw")
        END IF
        numeroriga += 1
        ME.Cell2(w, h, Mid(s, j, i - j), b, 2, align, fill)
      ELSE
        IF (align = "J") THEN
          $ws = IIf(ns > 1, (wmax - ls) / 1000 * $FontSize / (ns - 1), 0)
          _out(_stringFloat($ws * $k, "0.000") & " Tw")
        END IF
        numeroriga += 1
        ME.Cell2(w, h, Mid(s, j, sep - j), b, 2, align, fill)
        i = sep + 1
      END IF
      sep = -1
      j = i
      l = 0
      ns = 0
      INC nl
      IF (IsBoolean(border) OR IsInteger(border)) THEN
        IF (border AND nl = 2) THEN b = b2
      ELSE IF (IsString(border)) THEN
        IF (NOT IsNull(border) AND nl = 2) THEN b = b2
      END IF
    ELSE
      INC i
    END IF
  WEND
  'Last chunk
  IF ($ws > 0) THEN
    $ws = 0
    _out("0 Tw")
  END IF
  IF (IsString(border)) THEN
    IF (NOT IsNull(border) AND InStr(border, "B")) THEN b &= "B"
  END IF
  ME.Cell2(w, h, Mid(s, j, i - j), b, 2, align, fill)

  IF numeroriga = 0 THEN
  hriga = h
  ELSE IF numeroriga = 1 THEN
  hriga = (h * 2)
  ELSE IF numeroriga = 2 THEN
  hriga = (h * 3)
  ELSE IF numeroriga = 3 THEN
  hriga = (h * 4)
  ELSE IF numeroriga = 4 THEN
  hriga = (h * 5)  
  ENDIF

  $lasthmulti = Max($lasthmulti, hriga)
  
   $y = salva$y

  $x += w

END

PUBLIC SUB Lnm()
  'Line feed; default value is last cell height
  DIM k, x, y, ws, dx, wmax, wlink AS Float
    IF ($y + $lasthmulti > $PageBreakTrigger AND NOT $InFooter AND AcceptPageBreak()) THEN
    'Automatic page break
    x = $x
    ws = $ws
    IF (ws > 0) THEN
      $ws = 0
      _out("0 Tw")
    END IF
    ME.AddPage($CurOrientation)
    $x = x
    IF (ws > 0) THEN
      $ws = ws
      _out(_stringFloat(ws * k, "0.000") & " Tw")
    END IF
  END IF
  $x = $lMargin
  $y += $lasthmulti
  $lasthmulti = 0
END

PUBLIC SUB MultiRect(w1 AS Float, w2 AS Float, w3 AS Float, w4 AS Float, w5 AS Float, w6 AS Float, w7 AS Float)  
  IF w1 > 0 THEN ME.Rect($lMargin, $y, w1, $lasthmulti, "")
  IF w2 > 0 THEN ME.Rect($lMargin + w1, $y, w2, $lasthmulti, "")
  IF w3 > 0 THEN ME.Rect($lMargin + w1 + w2, $y, w3, $lasthmulti, "")
  IF w4 > 0 THEN ME.Rect($lMargin + w1 + w2 + w3, $y, w4, $lasthmulti, "")
  IF w5 > 0 THEN ME.Rect($lMargin + w1 + w2 + w3 + w4, $y, w5, $lasthmulti, "")
  IF w6 > 0 THEN ME.Rect($lMargin + w1 + w2 + w3 + w4 + w5, $y, w6, $lasthmulti, "")
  IF w7 > 0 THEN ME.Rect($lMargin + w1 + w2 + w3 + w4 + w5 + w6, $y, w7, $lasthmulti, "")
END



E uso così multiriga con multirect

Codice: gambas [Seleziona]
FOR EACH MyRS
  ME.MultiRiga(10, 5, MyRS!quantita, FALSE, "L", FALSE)
  ME.MultiRiga(32, 5, MyRS!codice, FALSE, "L", FALSE)            
  ME.MultiRiga(108, 5, MyRS!descrizione, FALSE, "L", FALSE)
  ME.MultiRiga(20, 5, MyRS!prezzo, FALSE, "R", FALSE)  
  ME.MultiRiga(20, 5, MyRS!prezzo * MyRS!quantita, FALSE, "R", FALSE)              
  ME.MultiRect(10, 32, 108, 20, 20, 0, 0)          
  ME.Lnm()
NEXT
« Ultima modifica: 02 Settembre 2010, 23:05:50 da Golia »

Offline Golia

  • Senatore Gambero
  • ******
  • Post: 1.298
  • no xe mai massa tardi
    • Mostra profilo
Re: Report con PdfWriter
« Risposta #29 il: 02 Settembre 2010, 23:01:08 »
Dimenticavo, per risolvere il problema del simbolo "€" ho fatto questa funzione che ho sempre inserito in PdfWriter

Codice: gambas [Seleziona]
PUBLIC SUB convcharacters(stringa AS String) AS String
stringa = Replace(stringa, "!", Chr(33))
stringa = Replace(stringa, "#", Chr(35))
stringa = Replace(stringa, "$", Chr(36))
stringa = Replace(stringa, "%", Chr(37))
stringa = Replace(stringa, "&", Chr(38))
stringa = Replace(stringa, "'", Chr(39))
stringa = Replace(stringa, "(", Chr(40))
stringa = Replace(stringa, ")", Chr(41))
stringa = Replace(stringa, "*", Chr(42))
stringa = Replace(stringa, "+", Chr(43))
stringa = Replace(stringa, ",", Chr(44))
stringa = Replace(stringa, "-", Chr(45))
stringa = Replace(stringa, ".", Chr(46))
stringa = Replace(stringa, "/", Chr(47))
stringa = Replace(stringa, "0", Chr(48))
stringa = Replace(stringa, "1", Chr(49))
stringa = Replace(stringa, "2", Chr(50))
stringa = Replace(stringa, "3", Chr(51))
stringa = Replace(stringa, "4", Chr(52))
stringa = Replace(stringa, "5", Chr(53))
stringa = Replace(stringa, "6", Chr(54))
stringa = Replace(stringa, "7", Chr(55))
stringa = Replace(stringa, "8", Chr(56))
stringa = Replace(stringa, "9", Chr(57))
stringa = Replace(stringa, ":", Chr(58))
stringa = Replace(stringa, ";", Chr(59))
stringa = Replace(stringa, "<", Chr(60))
stringa = Replace(stringa, "=", Chr(61))
stringa = Replace(stringa, ">", Chr(62))
stringa = Replace(stringa, "?", Chr(63))
stringa = Replace(stringa, "@", Chr(64))
stringa = Replace(stringa, "A", Chr(65))
stringa = Replace(stringa, "B", Chr(66))
stringa = Replace(stringa, "C", Chr(67))
stringa = Replace(stringa, "D", Chr(68))
stringa = Replace(stringa, "E", Chr(69))
stringa = Replace(stringa, "F", Chr(70))
stringa = Replace(stringa, "G", Chr(71))
stringa = Replace(stringa, "H", Chr(72))
stringa = Replace(stringa, "I", Chr(73))
stringa = Replace(stringa, "J", Chr(74))
stringa = Replace(stringa, "K", Chr(75))
stringa = Replace(stringa, "L", Chr(76))
stringa = Replace(stringa, "M", Chr(77))
stringa = Replace(stringa, "N", Chr(78))
stringa = Replace(stringa, "O", Chr(79))
stringa = Replace(stringa, "P", Chr(80))
stringa = Replace(stringa, "Q", Chr(81))
stringa = Replace(stringa, "R", Chr(82))
stringa = Replace(stringa, "S", Chr(83))
stringa = Replace(stringa, "T", Chr(84))
stringa = Replace(stringa, "U", Chr(85))
stringa = Replace(stringa, "V", Chr(86))
stringa = Replace(stringa, "W", Chr(87))
stringa = Replace(stringa, "X", Chr(88))
stringa = Replace(stringa, "Y", Chr(89))
stringa = Replace(stringa, "Z", Chr(90))
stringa = Replace(stringa, "[", Chr(91))
stringa = Replace(stringa, "\\", Chr(92))
stringa = Replace(stringa, "]", Chr(93))
stringa = Replace(stringa, "^", Chr(94))
stringa = Replace(stringa, "_", Chr(95))
stringa = Replace(stringa, "`", Chr(96))
stringa = Replace(stringa, "a", Chr(97))
stringa = Replace(stringa, "b", Chr(98))
stringa = Replace(stringa, "c", Chr(99))
stringa = Replace(stringa, "d", Chr(100))
stringa = Replace(stringa, "e", Chr(101))
stringa = Replace(stringa, "f", Chr(102))
stringa = Replace(stringa, "g", Chr(103))
stringa = Replace(stringa, "h", Chr(104))
stringa = Replace(stringa, "i", Chr(105))
stringa = Replace(stringa, "j", Chr(106))
stringa = Replace(stringa, "k", Chr(107))
stringa = Replace(stringa, "l", Chr(108))
stringa = Replace(stringa, "m", Chr(109))
stringa = Replace(stringa, "n", Chr(110))
stringa = Replace(stringa, "o", Chr(111))
stringa = Replace(stringa, "p", Chr(112))
stringa = Replace(stringa, "q", Chr(113))
stringa = Replace(stringa, "r", Chr(114))
stringa = Replace(stringa, "s", Chr(115))
stringa = Replace(stringa, "t", Chr(116))
stringa = Replace(stringa, "u", Chr(117))
stringa = Replace(stringa, "v", Chr(118))
stringa = Replace(stringa, "w", Chr(119))
stringa = Replace(stringa, "x", Chr(120))
stringa = Replace(stringa, "y", Chr(121))
stringa = Replace(stringa, "z", Chr(122))
stringa = Replace(stringa, "{", Chr(123))
stringa = Replace(stringa, "|", Chr(124))
stringa = Replace(stringa, "}", Chr(125))
stringa = Replace(stringa, "~", Chr(126))
stringa = Replace(stringa, "", Chr(127))
stringa = Replace(stringa, "€", Chr(128))
stringa = Replace(stringa, "", Chr(129))
stringa = Replace(stringa, "‚", Chr(130))
stringa = Replace(stringa, "ƒ", Chr(131))
stringa = Replace(stringa, "„", Chr(132))
stringa = Replace(stringa, "…", Chr(133))
stringa = Replace(stringa, "†", Chr(134))
stringa = Replace(stringa, "‡", Chr(135))
stringa = Replace(stringa, "ˆ", Chr(136))
stringa = Replace(stringa, "‰", Chr(137))
stringa = Replace(stringa, "Š", Chr(138))
stringa = Replace(stringa, "‹", Chr(139))
stringa = Replace(stringa, "Œ", Chr(140))
stringa = Replace(stringa, "", Chr(141))
stringa = Replace(stringa, "Ž", Chr(142))
stringa = Replace(stringa, "", Chr(143))
stringa = Replace(stringa, "", Chr(144))
stringa = Replace(stringa, "‘", Chr(145))
stringa = Replace(stringa, "’", Chr(146))
stringa = Replace(stringa, "“", Chr(147))
stringa = Replace(stringa, "”", Chr(148))
stringa = Replace(stringa, "•", Chr(149))
stringa = Replace(stringa, "–", Chr(150))
stringa = Replace(stringa, "—", Chr(151))
stringa = Replace(stringa, "˜", Chr(152))
stringa = Replace(stringa, "™", Chr(153))
stringa = Replace(stringa, "š", Chr(154))
stringa = Replace(stringa, "›", Chr(155))
stringa = Replace(stringa, "œ", Chr(156))
stringa = Replace(stringa, "", Chr(157))
stringa = Replace(stringa, "ž", Chr(158))
stringa = Replace(stringa, "Ÿ", Chr(159))
stringa = Replace(stringa, " ", Chr(160))
stringa = Replace(stringa, "¡", Chr(161))
stringa = Replace(stringa, "¢", Chr(162))
stringa = Replace(stringa, "£", Chr(163))
stringa = Replace(stringa, "¤", Chr(164))
stringa = Replace(stringa, "¥", Chr(165))
stringa = Replace(stringa, "¦", Chr(166))
stringa = Replace(stringa, "§", Chr(167))
stringa = Replace(stringa, "¨", Chr(168))
stringa = Replace(stringa, "©", Chr(169))
stringa = Replace(stringa, "ª", Chr(170))
stringa = Replace(stringa, "«", Chr(171))
stringa = Replace(stringa, "¬", Chr(172))
stringa = Replace(stringa, " ", Chr(173))
stringa = Replace(stringa, "®", Chr(174))
stringa = Replace(stringa, "¯", Chr(175))
stringa = Replace(stringa, "°", Chr(176))
stringa = Replace(stringa, "±", Chr(177))
stringa = Replace(stringa, "²", Chr(178))
stringa = Replace(stringa, "³", Chr(179))
stringa = Replace(stringa, "´", Chr(180))
stringa = Replace(stringa, "µ", Chr(181))
stringa = Replace(stringa, "¶", Chr(182))
stringa = Replace(stringa, "·", Chr(183))
stringa = Replace(stringa, "¸", Chr(184))
stringa = Replace(stringa, "¹", Chr(185))
stringa = Replace(stringa, "º", Chr(186))
stringa = Replace(stringa, "»", Chr(187))
stringa = Replace(stringa, "¼", Chr(188))
stringa = Replace(stringa, "½", Chr(189))
stringa = Replace(stringa, "¾", Chr(190))
stringa = Replace(stringa, "¿", Chr(191))
stringa = Replace(stringa, "À", Chr(192))
stringa = Replace(stringa, "Á", Chr(193))
stringa = Replace(stringa, "Â", Chr(194))
stringa = Replace(stringa, "Ã", Chr(195))
stringa = Replace(stringa, "Ä", Chr(196))
stringa = Replace(stringa, "Å", Chr(197))
stringa = Replace(stringa, "Æ", Chr(198))
stringa = Replace(stringa, "Ç", Chr(199))
stringa = Replace(stringa, "È", Chr(200))
stringa = Replace(stringa, "É", Chr(201)) 
stringa = Replace(stringa, "Ê", Chr(202))   
stringa = Replace(stringa, "Ë", Chr(203)) 
stringa = Replace(stringa, "Ì", Chr(204))
stringa = Replace(stringa, "Í", Chr(205)) 
stringa = Replace(stringa, "Î", Chr(206))   
stringa = Replace(stringa, "Ï", Chr(207))   
stringa = Replace(stringa, "Ð", Chr(208))
stringa = Replace(stringa, "Ñ", Chr(209))
stringa = Replace(stringa, "Ò", Chr(210))
stringa = Replace(stringa, "Ó", Chr(211))
stringa = Replace(stringa, "Ô", Chr(212))
stringa = Replace(stringa, "Õ", Chr(213))
stringa = Replace(stringa, "Ö", Chr(214))
stringa = Replace(stringa, "×", Chr(215))
stringa = Replace(stringa, "Ø", Chr(216))
stringa = Replace(stringa, "Ù", Chr(217))
stringa = Replace(stringa, "Ú", Chr(218))
stringa = Replace(stringa, "Û", Chr(219))
stringa = Replace(stringa, "Ü", Chr(220))
stringa = Replace(stringa, "Ý", Chr(221))
stringa = Replace(stringa, "Þ", Chr(222))
stringa = Replace(stringa, "ß", Chr(223))
stringa = Replace(stringa, "à", Chr(224))
stringa = Replace(stringa, "á", Chr(225))
stringa = Replace(stringa, "â", Chr(226))
stringa = Replace(stringa, "ã", Chr(227))
stringa = Replace(stringa, "ä", Chr(228))
stringa = Replace(stringa, "å", Chr(229))
stringa = Replace(stringa, "æ", Chr(230))
stringa = Replace(stringa, "ç", Chr(231))
stringa = Replace(stringa, "è", Chr(232))
stringa = Replace(stringa, "é", Chr(233))
stringa = Replace(stringa, "ê", Chr(234))
stringa = Replace(stringa, "ë", Chr(235))
stringa = Replace(stringa, "ì", Chr(236))
stringa = Replace(stringa, "í", Chr(237))
stringa = Replace(stringa, "î", Chr(238))
stringa = Replace(stringa, "ï", Chr(239))
stringa = Replace(stringa, "ð", Chr(240))
stringa = Replace(stringa, "ñ", Chr(241))
stringa = Replace(stringa, "ò", Chr(242))
stringa = Replace(stringa, "ó", Chr(243))
stringa = Replace(stringa, "ô", Chr(244))
stringa = Replace(stringa, "õ", Chr(245))
stringa = Replace(stringa, "ö", Chr(246))
stringa = Replace(stringa, "÷", Chr(247))
stringa = Replace(stringa, "ø", Chr(248))
stringa = Replace(stringa, "ù", Chr(249))
stringa = Replace(stringa, "ú", Chr(250))
stringa = Replace(stringa, "û", Chr(251))
stringa = Replace(stringa, "ü", Chr(252))
stringa = Replace(stringa, "ý", Chr(253))
stringa = Replace(stringa, "þ", Chr(254))
stringa = Replace(stringa, "ÿ", Chr(255))
RETURN stringa
END