Page 1 of 1

Print Functions

PostPosted: Sun Apr 30, 2017 3:22 am
by StarterPack
Hi guys, I want to print a variable (Multi-line) selected but i want to add header and footer to my page.
With PrintDataFile you cannot choose a [variable] to print but only a external file.

Any help please

Re: Print Functions

PostPosted: Sun Apr 30, 2017 5:57 am
by HPW
Hello,
From the doc:
Print an external plain text (ASCII) data file (usually created with the FileWrite Action).


So filewrite your variable to a temp-file and print that.

Regards

Re: Print Functions

PostPosted: Sun Apr 30, 2017 11:07 am
by StarterPack
Hi HPW

Thank You... I now about that function but that does not work with what I want to do. I want to use PrintPage function because I have words with chords on top of it.

A________E_______D__________A
We'll do it all, everything, on our own.
A_______E______D___________A
We don't need anything, or any-one.
________A__________E
If I lay - here, if I just lay – here,
_________D___________________________A
Would you lie with me, and just forget the world?

If I export to text file, the Chords are not where it must be anymore because of the spaces

PrintPage works excellent but I thought there could be a way to add a Footer with that

Re: Print Functions

PostPosted: Sun Apr 30, 2017 12:17 pm
by Gaev
Starterpack:

If I export to text file, the Chords are not where it must be anymore because of the spaces
PrintPage works excellent but I thought there could be a way to add a Footer with that

Still very confusing ... how does a Footer help alleviate your problem ?

Do you have an image of what your ...

- TextEntry Box
- output from PrintDataFile

... looks like ?

Have you considered generating an HTML (i.e. rich text) file ... and then having it viewed/printed from the Browser object ?

Re: Print Functions

PostPosted: Sun Apr 30, 2017 12:56 pm
by StarterPack
Have you considered generating an HTML (i.e. rich text) file ... and then having it viewed/printed from the Browser object ?


Thank You Gaev. I Think I need to do that

Re: Print Functions

PostPosted: Sun May 21, 2017 1:13 am
by StarterPack
Have you considered generating an HTML (i.e. rich text) file ... and then having it viewed/printed from the Browser object


Hi Gaev, I took awhile of to clear my mind from the program i'm building. To get back to this function. How do i generate to HTML?

Re: Print Functions

PostPosted: Sun May 21, 2017 7:47 am
by Gaev
StarterPack:

How do i generate to HTML?

An HTML file (i.e. .htm/.html) is just a plain text file with <tags> to instruct the browser to do rich text formating e.g.
Code: Select all
<html>

<head>
</head>

<body>

<p>I am a new paragraph</p>

<br/>New line here

<br/>I am <i>italic</i>, <b>bold</b> and <u>underscored</u>

</body>

</html>

To learn about the tags, take a look at https://www.w3schools.com/html/default.asp and https://www.w3schools.com/css/default.asp ... and practice using notepad.exe (or similar text editor) to create such files ... and view them in your Browser.

Within your Application, you can create a text file (with desired tags) using FileWrite commands ... easier if you ...

- have a "template" text file that you FileRead
- insert/replace text strings as required
- then do the FileWrite
- and then use the Web Browser object to view/print it

Re: Print Functions

PostPosted: Sun May 21, 2017 11:27 am
by Wrangler
How about creating and printing an article? You can use tables to control the formatting (mostly).

Re: Print Functions

PostPosted: Mon May 29, 2017 5:52 am
by StarterPack
Hi Gaev and Wrangler

Thank you for your reply.

Gaev, thank you, I have a new learning hobby now with html.

The problem I have is when I write a TextEntry (Multiline selected) to ext. text file
Example:

DAYS OF ELIJAH - KEY: G*
-------------------------------
Verse 1
G*------------------------------C*
THESE ARE THE DAYS OF E_LIJAH
-----D*-------------------------------G*
DE_CLARING THE WORD OF THE LORD

AND THESE ARE THE DAYS OF
--------C*
YOUR SERVANT MOSES
D*------------------------------G*
RIGHTEOUSNESS BEING RE_STORED

Verse 2
-----------------D*------------------------------------Em*
AND THOUGH THESE ARE THE DAYS OF GREAT TRIAL
----C*-------------------------------D*
OF FAMINE AND DARKNESS AND SWORD
G*-------------------------------------C*
STILL WE ARE THE VOICE IN THE DESERT CRYING
------G*-------------D*-------------G*
PRE_PARE YE THE WAY OF THE LORD….

it shows correct, but when I load it in Web Browser it shows like this

Days Of Elijah
G*
| DAYS OF ELIJAH - KEY: G*| ---------------------------------------|Verse 1|G* C* |THESE ARE THE DAYS OF E_LIJAH| D* G*|DE_CLARING THE WORD OF THE LORD||AND THESE ARE THE DAYS OF| C*|YOUR SERVANT MOSES|D* G*|RIGHTEOUSNESS BEING RE_STORED||Verse 2| D* Em*|AND THOUGH THESE ARE THE DAYS OF GREAT TRIAL| C* D*|OF FAMINE AND DARKNESS AND SWORD|G* C*|STILL WE ARE THE VOICE IN THE DESERT CRYING| G* D* G*|PRE_PARE YE THE WAY OF THE LORD….

I tried everything but it doesn't load it the same way as in the text file.

Re: Print Functions

PostPosted: Mon May 29, 2017 7:04 am
by Gaev
StarterPack:

Unlike Windows, HTML ignores "new line" control characters ... instead, you have to use the <br/> tag ... so use StrReplace on your multi-line text to replace all instances of "[#13][#10]" to "!<br/>" ... then use the variable containing the replaced text in your HTML.

Re: Print Functions

PostPosted: Mon May 29, 2017 9:46 am
by virger
1) En Text 'properties' "WORD WRAP" NO LO MARQUE

2) Lea el file
FileRead "El_Texto" "All" "[tx]"

3) Si quiere adornar 'LORD' haga esto
StrReplace "[tx]" "LORD" "<font color='red'><u><i><b>LORD</b></i></u></font>" "[tx]" ""

4) Utilice BrowserLoadFromStr
BrowserLoadFromStr "Web" "<html>|<body>|<pre>|[tx]|</pre>|</body>|</html>"

5) Me cuentas el resultado

Gracias por leerme

Re: Print Functions

PostPosted: Mon May 29, 2017 3:40 pm
by StarterPack
Unlike Windows, HTML ignores "new line" control characters ... instead, you have to use the <br/> tag ... so use StrReplace on your multi-line text to replace all instances of "[#13][#10]" to "!<br/>" ... then use the variable containing the replaced text in your HTML.


Gaev, this works perfect! Thank You

Two things thou

The chords move all to the left side and are not in place anymore
Oh and I use the --------------------------- lines just to show where the chords must be, but it's actually spaces

Example

DAYS OF ELIJAH - KEY: G*
-------------------------------
Verse 1
G*------------------------------C*
THESE ARE THE DAYS OF E_LIJAH
-----D*-------------------------------G*
DE_CLARING THE WORD OF THE LORD

AND THESE ARE THE DAYS OF
--------C*
YOUR SERVANT MOSES
D*------------------------------G*
RIGHTEOUSNESS BEING RE_STORED

It shows like this now

DAYS OF ELIJAH - KEY: G*
-------------------------------
Verse 1
G* C*
THESE ARE THE DAYS OF E_LIJAH
D* G*
DE_CLARING THE WORD OF THE LORD

AND THESE ARE THE DAYS OF
C*
YOUR SERVANT MOSES
D* G*
RIGHTEOUSNESS BEING RE_STORED

And also, how do I set the Font Style and Size in the Browser from a variable.

Thank You

Re: Print Functions

PostPosted: Mon May 29, 2017 5:00 pm
by Gaev
StarterPack:

Multiple spaces normally created by the spacebar, the tab key and return key are all ignored when you write code. HTML just interprets them all as whitespace between words, and displays a single space.

This webpage ... http://www.wikihow.com/Insert-Spaces-in-HTML ... shows one way to have multiple spaces displayed.

There is also a solution that involves CSS e.g. https://stackoverflow.com/questions/450 ... thout-nbsp

But probably the best way is to wrap your text inside <pre>abcd</pre> tags ... which also uses a monospaced font ... details here ... https://developer.mozilla.org/en-US/doc ... lement/pre

And also, how do I set the Font Style and Size in the Browser from a variable.

The simplest way would be to use PopulateStr ... see Help file for details.

Re: Print Functions

PostPosted: Tue May 30, 2017 9:39 am
by dpayer
StarterPack wrote:And also, how do I set the Font Style and Size in the Browser from a variable.

Thank You


Something that may be helpful here. If you use a constant width font like COURIER (the old typewriter font) you will get the same width for each character and your spacing will be more clear. It is not a beautiful font, but it serves the purpose for this. There are some other fonts with the same characteristic you can choose from as well. Thats something you can Mr. Google about.