Source language: Translate to:

Print Functions

General questions about NeoBook

Moderator: Neosoft Support

Print Functions

Postby StarterPack » Sun Apr 30, 2017 3:22 am

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
StarterPack
 
Posts: 115
Joined: Fri Feb 19, 2016 6:55 am

Re: Print Functions

Postby HPW » Sun Apr 30, 2017 5:57 am

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
Hans-Peter
User avatar
HPW
 
Posts: 2519
Joined: Fri Apr 01, 2005 11:24 pm
Location: Germany

Re: Print Functions

Postby StarterPack » Sun Apr 30, 2017 11:07 am

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
StarterPack
 
Posts: 115
Joined: Fri Feb 19, 2016 6:55 am

Re: Print Functions

Postby Gaev » Sun Apr 30, 2017 12:17 pm

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 ?
User avatar
Gaev
 
Posts: 3728
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Re: Print Functions

Postby StarterPack » Sun Apr 30, 2017 12:56 pm

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
StarterPack
 
Posts: 115
Joined: Fri Feb 19, 2016 6:55 am

Re: Print Functions

Postby StarterPack » Sun May 21, 2017 1:13 am

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?
StarterPack
 
Posts: 115
Joined: Fri Feb 19, 2016 6:55 am

Re: Print Functions

Postby Gaev » Sun May 21, 2017 7:47 am

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
User avatar
Gaev
 
Posts: 3728
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Re: Print Functions

Postby Wrangler » Sun May 21, 2017 11:27 am

How about creating and printing an article? You can use tables to control the formatting (mostly).
Wrangler
--------------
"You never know about a woman. Whether she'll laugh, cry or go for a gun." - Louis L'Amour

Windows 7 Ultimate SP1 64bit
16GB Ram
Asus GTX 950 OC Strix
Software made with NeoBook
http://highdesertsoftware.com
User avatar
Wrangler
 
Posts: 1506
Joined: Thu Mar 31, 2005 11:40 pm
Location: USA

Re: Print Functions

Postby StarterPack » Mon May 29, 2017 5:52 am

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.
StarterPack
 
Posts: 115
Joined: Fri Feb 19, 2016 6:55 am

Re: Print Functions

Postby Gaev » Mon May 29, 2017 7:04 am

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.
User avatar
Gaev
 
Posts: 3728
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Re: Print Functions

Postby virger » Mon May 29, 2017 9:46 am

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
COSTA RICA
PURA VIDA
User avatar
virger
 
Posts: 518
Joined: Mon Sep 18, 2006 12:21 pm
Location: Costa Rica, America Central

Re: Print Functions

Postby StarterPack » Mon May 29, 2017 3:40 pm

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
StarterPack
 
Posts: 115
Joined: Fri Feb 19, 2016 6:55 am

Re: Print Functions

Postby Gaev » Mon May 29, 2017 5:00 pm

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.
User avatar
Gaev
 
Posts: 3728
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Re: Print Functions

Postby dpayer » Tue May 30, 2017 9:39 am

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.
David Payer
Des Moines, Iowa
USA
User avatar
dpayer
 
Posts: 1382
Joined: Mon Apr 11, 2005 5:55 am
Location: Iowa - USA


Return to General NeoBook Discussions

Who is online

Users browsing this forum: No registered users and 2 guests