1. Blatt wrapper question

If I use eublatt to email a txt file (i.e an invoice or quotation) does
the result seen by the receiver look like it would if printed on a printer?

In the past (on another OS) spaces have been removed and then columnar data
is no longer lined up? If it is not lined up how can I solve this problem.

new topic     » topic index » view message » categorize

2. Re: Blatt wrapper question

George Walters wrote:
> 
> If I use eublatt to email a txt file (i.e an invoice or quotation) does
> the result seen by the receiver look like it would if printed on a printer?

You can't know that unless you know how the user will be viewing it.

If someone views a text file in Microsoft Word, it's quite possible that it
will NOT look the same as when viewed in Notepad. That's simply because of
the different fonts used by each application.

However, if you create the file in Notepad and the viewer uses Notepad to
view it, then yes, it will look the same as when printed.

-=ck
"Programming in a state of EUPHORIA."
http://www.cklester.com/euphoria/

new topic     » goto parent     » topic index » view message » categorize

3. Re: Blatt wrapper question

cklester wrote:
> 
> George Walters wrote:
> > 
> > If I use eublatt to email a txt file (i.e an invoice or quotation) does
> > the result seen by the receiver look like it would if printed on a printer?
> 
> You can't know that unless you know how the user will be viewing it.
> 
> If someone views a text file in Microsoft Word, it's quite possible that it
> will NOT look the same as when viewed in Notepad. That's simply because of
> the different fonts used by each application.
> 
> However, if you create the file in Notepad and the viewer uses Notepad to
> view it, then yes, it will look the same as when printed.
> 
> -=ck
> "Programming in a state of EUPHORIA."
> <a
> href="http://www.cklester.com/euphoria/">http://www.cklester.com/euphoria/</a>
> 

CK:
  If he sent it in HTML then it would look the same
wouldn't it ?

Bernie

My files in archive:
w32engin.ew mixedlib.e eu_engin.e win32eru.ew

Can be downloaded here:
http://www.rapideuphoria.com/cgi-bin/asearch.exu?dos=on&win=on&lnx=on&gen=on&keywords=bernie+ryan

new topic     » goto parent     » topic index » view message » categorize

4. Re: Blatt wrapper question

Bernie Ryan wrote:
> cklester wrote:
> > George Walters wrote:
> > > If I use eublatt to email a txt file (i.e an invoice or quotation) does
> > > the result seen by the receiver look like it would if printed on a
> > > printer?
> > You can't know that unless you know how the user will be viewing it.
> > If someone views a text file in Microsoft Word, it's quite possible that it
> > will NOT look the same as when viewed in Notepad. That's simply because of
> > the different fonts used by each application.
> > However, if you create the file in Notepad and the viewer uses Notepad to
> > view it, then yes, it will look the same as when printed.
> If he sent it in HTML then it would look the same
> wouldn't it ?

Yeah, I'd think that HTML would be a good format for distribution of something
like that... as long as the user viewed it in a browser and not in, say,
Notepad! heheh.

-=ck
"Programming in a state of EUPHORIA."
http://www.cklester.com/euphoria/

new topic     » goto parent     » topic index » view message » categorize

5. Re: Blatt wrapper question

I think that would work. I've looked in the archives for a txt to html
converter but did not find one. There's one in pearl and some for sale.
Has anyone attempted this in EU?

new topic     » goto parent     » topic index » view message » categorize

6. Re: Blatt wrapper question

George Walters wrote:

> I think that would work. I've looked in the archives for a txt to html
> converter but did not find one. There's one in pearl and some for sale.
> Has anyone attempted this in EU?

Yep. If you want to buy a converter, please tell me. blink

Or use the following code. It is deliberately simple (for instance if there
is a URL in the text, it won't be "clickable" in the generated HTML file).
However, it exactly shows the text like it is in the plain text file, with
all columns at their correct position.

function rextract (sequence source, object x)
   for i = length(source) to 1 by -1 do
      if equal(source[i], x) then
         return source[1..i-1]
      end if
   end for

   return source
end function


constant
HTML_HEADER = "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01
   Transitional//EN\">\n"
               & "<html>\n"
               & "<head>\n"
& "<meta http-equiv=\"Content-Type\" content=\"text/html;
               charset=iso-8859-15\">\n"
               & "<title>%s</title>\n"
               & "</head>\n\n"
               & "<body>\n",

   HTML_FOOTER = "</body>\n"
               & "</html>"

global procedure text2html (sequence infile)
   object line
   sequence title, outfile
   integer ifn, ofn

   title = rextract(infile, '.')
   outfile = title & ".htm"
   ifn = open(infile, "r")
   ofn = open(outfile, "w")

   printf(ofn, HTML_HEADER, {title})
   puts(ofn, "<pre>\n")
   while 1 do
      line = gets(ifn)
      if atom(line) then exit end if

      puts(ofn, line)
   end while
   puts(ofn, "</pre>\n")
   puts(ofn, HTML_FOOTER)

   close(ifn)
   close(ofn)
end procedure


include file.e                  -- for dir()
include get.e                   -- for wait_key()

constant CMD = command_line()

object list, void

if length(CMD) < 3 then
   puts(1, "Usage: txt2html <filespec>")
   void = wait_key()
   abort(1)
end if

list = dir(CMD[3])
if atom(list) then
   puts(1, "No matching file found: " & CMD[3])
   void = wait_key()
   abort(1)
end if

for i = 1 to length(list) do
   text2html(list[i][D_NAME])
end for


Regards,
   Juergen

new topic     » goto parent     » topic index » view message » categorize

7. Re: Blatt wrapper question

Wonderful, thanks. I'll give it a try.

new topic     » goto parent     » topic index » view message » categorize

8. Re: Blatt wrapper question

George Walters wrote:

> Wonderful, thanks. I'll give it a try.

The code that I had posted previously is not correct. sad
I had assumed by mistake, that between <pre> and </pre> it's not necessary
to mask certain characters. But it _is_ necessary. Here is the corrected
version:

-- simple txt2HTML program, 2005-05-04 by Juergen Luethje
-- (requires at least Eu 2.5 because of $)

-------------------------[ utility functions ]--------------------------

function rextract (sequence source, object x)
   for i = length(source) to 1 by -1 do
      if equal(source[i], x) then
         return source[1..i-1]
      end if
   end for
   return source
end function

function matchs (sequence s, sequence source, integer start)
   integer posn

   if start >= 1 and start <= length(source) then
      posn = match(s, source[start..$])
      if posn then
         return posn + start - 1
      end if
   end if
   return 0
end function

function replace (sequence source, sequence whatToReplace, sequence replaceWith)
   integer posn

   if length(whatToReplace) then
      posn = match(whatToReplace, source)
      while posn do
source = source[1..posn-1] & replaceWith &
         source[posn+length(whatToReplace)..$]
         posn = matchs(whatToReplace, source, posn+length(replaceWith))
      end while
   end if
   return source
end function

----------------------------[ text to HTML ]----------------------------

constant
HTML_HEADER = "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01
   Transitional//EN\">\n"
               & "<html>\n"
               & "<head>\n"
& "<meta http-equiv=\"Content-Type\" content=\"text/html;
               charset=iso-8859-15\">\n"
               & "<title>%s</title>\n"
               & "</head>\n\n"
               & "<body>\n",

   HTML_FOOTER = "</body>\n"
               & "</html>"

global procedure text2html (sequence infile)
   object line
   sequence title, outfile
   integer ifn, ofn

   title = rextract(infile, '.')
   outfile = title & ".htm"
   ifn = open(infile, "r")
   ofn = open(outfile, "w")

   printf(ofn, HTML_HEADER, {title})
   puts(ofn, "<pre>\n")
   while 1 do
      line = gets(ifn)
      if atom(line) then
         exit
      end if
      line = replace(line, "&", "&amp;")
      line = replace(line, "<", "&lt;")
      line = replace(line, ">", "&gt;")
      line = replace(line, "\"", "&quot;")
      line = replace(line, {128}, "&euro;")
      puts(ofn, line)
   end while
   puts(ofn, "</pre>\n")
   puts(ofn, HTML_FOOTER)

   close(ifn)
   close(ofn)
end procedure

--------------------------------[ main ]--------------------------------

include file.e                  -- for dir()
include get.e                   -- for wait_key()

constant CMD = command_line()

object list, void

if length(CMD) < 3 then
   puts(1, "Usage: txt2html <filespec>")
   void = wait_key()
   abort(1)
end if

list = dir(CMD[3])
if atom(list) then
   puts(1, "No matching file found: " & CMD[3])
   void = wait_key()
   abort(1)
end if

for i = 1 to length(list) do
   text2html(list[i][D_NAME])
end for


Regards,
   Juergen

new topic     » goto parent     » topic index » view message » categorize

9. Re: Blatt wrapper question

I wrote:

> George Walters wrote:
> 
>> Wonderful, thanks. I'll give it a try.
> 
> The code that I had posted previously is not correct. sad
> I had assumed by mistake, that between <pre> and </pre> it's not necessary
> to mask certain characters. But it _is_ necessary. Here is the corrected
> version:
> 
> }}}
<eucode>

Unfortunately, the code partly is shown incorrect on EUforum (e-mail is
currently "dead" again anyway ...).

<snip>

>       line = replace(line, "&", "&")
>       line = replace(line, "<", "<")
>       line = replace(line, ">", ">")

<snip>

The above lines are not correct. The software that generates the EUforum
HTML pages probably is confused what parts of my code that looks like HTML
should be interpreted, and what parts should be displayed unchanged.
So I'll try out the new EUforum attachment feature. The corrected version
of my little program should be here:
   http://www.RapidEuphoria.com/uploads/txt2html.zip

Regards,
   Juergen

new topic     » goto parent     » topic index » view message » categorize

10. Re: Blatt wrapper question

George Walters wrote:
> 
> I think that would work. I've looked in the archives for a txt to html
> converter but did not find one. There's one in pearl and some for sale.
> Has anyone attempted this in EU?

Do your original template in HTML so you don't have to convert... or do you
have a txt file already and you want to convert it?

-=ck
"Programming in a state of EUPHORIA."
http://www.cklester.com/euphoria/

new topic     » goto parent     » topic index » view message » categorize

11. Re: Blatt wrapper question

Juergen Luethje wrote:
> 
> So I'll try out the new EUforum attachment feature. The corrected version
> of my little program should be here:
>    http://www.RapidEuphoria.com/uploads/txt2html.zip

Rob, you can make URLs clicky... :)

-=ck
"Programming in a state of EUPHORIA."
http://www.cklester.com/euphoria/

new topic     » goto parent     » topic index » view message » categorize

12. Re: Blatt wrapper question

George Walters wrote:

> If I use eublatt to email a txt file (i.e an invoice or quotation) does
> the result seen by the receiver look like it would if printed on a printer?
>
> In the past (on another OS) spaces have been removed and then columnar data
> is no longer lined up? If it is not lined up how can I solve this problem.

What is eublatt? I searched for "blatt" and "eublatt" in the archieves,
but didn't get a result.

Regards,
   Juergen

new topic     » goto parent     » topic index » view message » categorize

13. Re: Blatt wrapper question

Juergen Luethje wrote:
> 
> What is eublatt? I searched for "blatt" and "eublatt" in the archieves,
> but didn't get a result.

Look for "blat." It's an SMTP library for Windows.

-=ck
"Programming in a state of EUPHORIA."
http://www.cklester.com/euphoria/

new topic     » goto parent     » topic index » view message » categorize

14. Re: Blatt wrapper question

cklester wrote:

> Juergen Luethje wrote:
>> 
>> So I'll try out the new EUforum attachment feature. The corrected version
>> of my little program should be here:
>>    http://www.RapidEuphoria.com/uploads/txt2html.zip
> 
> Rob, you can make URLs clicky... :)

In your post, the quoted URL is clicky. smile
I believe it was my fault, because by mistake I wrote the URL between
[eudode][/eudode].

Regards,
   Juergen

new topic     » goto parent     » topic index » view message » categorize

15. Re: Blatt wrapper question

Juergen Luethje wrote:
> cklester wrote:
> > Juergen Luethje wrote:
> >> So I'll try out the new EUforum attachment feature. The corrected version
> >> of my little program should be here:
> >>    <a
> >>    href="http://www.RapidEuphoria.com/uploads/txt2html.zip">http://www.RapidEuphoria.com/uploads/txt2html.zip</a>
> > Rob, you can make URLs clicky... :)
> In your post, the quoted URL is clicky. smile
> I believe it was my fault, because by mistake I wrote the URL between
> [eudode][/eudode].

Yeah, I noticed that it was clickly in the reply to my message... which
baffled me for a moment. heheh.

-=ck
"Programming in a state of EUPHORIA."
http://www.cklester.com/euphoria/

new topic     » goto parent     » topic index » view message » categorize

16. Re: Blatt wrapper question

cklester wrote:

> Juergen Luethje wrote:
>> 
>> What is eublatt? I searched for "blatt" and "eublatt" in the archieves,
>> but didn't get a result.
> 
> Look for "blat." It's an SMTP library for Windows.

Ah, I see. In the expression    "bla" & repeat('t', n)
n must be 1 rather than 2. blink

Thanks,
   Juergen

new topic     » goto parent     » topic index » view message » categorize

17. Re: Blatt wrapper question

They are text files destined to be printed (5 form types for invoices,
and 5 form types for quotations, and purchase orders). Some of them, after
being printed need to also be either faxed, or emailed, or both.

new topic     » goto parent     » topic index » view message » categorize

18. Re: Blatt wrapper question

George Walters wrote:

> They are text files destined to be printed (5 form types for invoices,
> and 5 form types for quotations, and purchase orders). Some of them, after
> being printed need to also be either faxed, or emailed, or both.

Just decide on a nice text-only format and create a template for it. That's
what I've done for an emailed notice I send to clients. I embed "field codes"
and then just insert the appropriate data. For an invoice and quote system,
you'd probably want to come up with some fancy stuff to be able to lay out
the line items. I wonder if Kanary would be useful here...

   http://users.telenet.be/tommycarlier/eu/genlib.htm

If you want to go "nicely formatted," with "graphics" (logos, etc),
non-monospaced fonts, etc., wxWidgets has a wxHTML widget that would let
you display the invoice in HTML and print it out that way as well. You
could use graphics, logos, etc. That would be very cool. You could also
alert the customer that the documents you send are HTML formatted, and
give them a clue that they should view and print them with a web browser.

-=ck
"Programming in a state of EUPHORIA."
http://www.cklester.com/euphoria/

new topic     » goto parent     » topic index » view message » categorize

19. Re: Blatt wrapper question

Juergen Luethje wrote:
> <snip>
> 
> >       line = replace(line, "&", "&")
> >       line = replace(line, "<", "<")
> >       line = replace(line, ">", ">")
> 
> <snip>
How about:
line = replace(line,"&","&amp;amp;")
line = replace(line,"&","&amp;lt;")
line = replace(line,"&","&amp;gt;")


blink

Mario Steele
http://enchantedblade.trilake.net
Attaining World Dominiation, one byte at a time...

new topic     » goto parent     » topic index » view message » categorize

20. Re: Blatt wrapper question

George Walters wrote:
> 
> They are text files destined to be printed (5 form types for invoices,
> and 5 form types for quotations, and purchase orders). Some of them, after
> being printed need to also be either faxed, or emailed, or both.
> 
Inhouse I build reports using RTF (rich text format) tags. 
the managers couldn't bother with setting font size, margins,
and landscape layout, so I preconfigured them for optimal printing.
They file type is associated with Word,
 so they open in that on reciept. 

You can't do that with plain HTML. 

Internally the documents carry tags identifying the
author, source, keywords, page header and footer tags,
 and securty classification that could potentially 
be tracked by the email system to see if 
propietary info is being leaked out. 

you could also embed your graphic objects into the document.

you might also look at a text to PDF converter that's in the archives.

--"ask about our layaway plan".
--

new topic     » goto parent     » topic index » view message » categorize

21. Re: Blatt wrapper question

Mario Steele wrote:

> Juergen Luethje wrote:
>> <snip>
>>
>>>       line = replace(line, "&", "&")
>>>       line = replace(line, "<", "<")
>>>       line = replace(line, ">", ">")
>>
>> <snip>
> How about:

Not exactly. blink

> }}}
<eucode>
> line = replace(line,"&","&amp;amp;")
> line = replace(line,"&","&amp;lt;")
              Must be "<" here.

> line = replace(line,"&","&amp;gt;")
              Must be ">" here.
> </eucode>
{{{

>
> blink

However, now it looks on EUforum as expected, but not in e-mail.
When it's written as plain text (in the EUforum input field or in e-mail),
it looks correct in e-mail, but not on EUforum.
I think this is a bug in the "text to HTML" functionality of the EUforum
software.

Regards,
   Juergen

PS: The program http://www.RapidEuphoria.com/uploads/txt2html.zip
    that I uploaded some says ago converts such expressions correctly
    to HTML. smile

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu