Source language: Translate to:

RTF files have varying linespacing in NB

General questions about NeoBook

Moderator: Neosoft Support

RTF files have varying linespacing in NB

Postby Enigman » Sat Oct 04, 2014 10:32 am

I am creating a series of RTF files in WordPad that will be embedded in my app as help files. The RTF's contain graphics in addition to the text.

I have noticed that when the files are displayed in NB, the paragaphs can have varying linespacing sizes, for no obvious reason. It doesn't matter if I explicitly set the linespacing in WordPad when they are edited. When they display in NB they seem to do their own thing.

Does anyone know how to stabilze the RTF linespacing display in NeoBook?

Thanks.
User avatar
Enigman
 
Posts: 314
Joined: Tue Apr 12, 2005 3:57 pm
Location: Foothill Ranch, CA

Re: RTF files have varying linespacing in NB

Postby Neosoft Support » Sat Oct 04, 2014 2:47 pm

I haven't seen this specific issue before, but sometimes RTF files can get end up with extraneous formatting codes that can impact how they are rendered. For example, if you've changed fonts several time or inserted and deleted text, there may be empty formatting code in the document that you can't see in WordPad. NeoBook's rather primitive RTF parser may be seeing some of that code and interpreting it incorrectly resulting in the strange line height behavior. You could try selecting a block of code in WordPad and setting it all to the same font face and size and see if that makes any difference.
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5593
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Re: RTF files have varying linespacing in NB

Postby Enigman » Sat Oct 04, 2014 4:05 pm

You could try selecting a block of code in WordPad and setting it all to the same font face and size and see if that makes any difference.

Yeah, I have tried several permutations of that. If I open the RTF file in Notepad I can see that there is only one paragraph linespacing tag at the top of the file.

I do notice that having images in the file makes a difference in how it renders text. If an image is full screen width in the editor and set to 100%, then sometimes the text gets wonky (technical term), but if I set it back to 99% (the default for WordPad), then the text works right. Other times it just flat refuses to linespace all paragraphs the same size.

According to the RTF specification, the LACK of a linespacing tag causes the paragraph to line space according to the tallest character in the paragraph. But if the text is all the same size then I would think that it should all linespace the same.

Hmmmmm ...
User avatar
Enigman
 
Posts: 314
Joined: Tue Apr 12, 2005 3:57 pm
Location: Foothill Ranch, CA

Re: RTF files have varying linespacing in NB

Postby Wrangler » Sun Oct 05, 2014 8:54 am

I've had the best luck with RTF display in Neobook when creating and editing the RTF in Neobook rtf editor. Seems not because neobook editor is better than wordpad, but that it likes what it creates itself better than what wordpad creates.

As an example, I have a program that I use RTF as a template for a letter, strreplacing code as I need it. The original templates were created in an older version of Word. A couple years later I edited a template in the newer version of Word. Then the code wouldn't replace properly because it had changed. Anyway, the code seems to be slightly different when using Neobook or Wordpad or Word.

My plans are to switch the system over to html, which gives me much more control. I switched in my newspaper generating pub, and it now works great and I can easily make changes.

So you may want to look at html as an alternative to RTF.
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: 1505
Joined: Thu Mar 31, 2005 11:40 pm
Location: USA

Re: RTF files have varying linespacing in NB

Postby Enigman » Sun Oct 05, 2014 9:31 am

I've had the best luck with RTF display in Neobook when creating and editing the RTF in Neobook rtf editor. Seems not because neobook editor is better than wordpad, but that it likes what it creates itself better than what wordpad creates.

LOL ... I complete forgot about the built-in editor. I have never used it before. That makes sense that it would create more NB friendly RTF. I'll experiment with that.

The original templates were created in an older version of Word. A couple years later I edited a template in the newer version of Word. Then the code wouldn't replace properly because it had changed. Anyway, the code seems to be slightly different when using Neobook or Wordpad or Word.

Absolutely. Word makes a total mess out of the RTF codes. Just disastrous horrible looking stuff. And like you said, the newer the Word, the worse it gets. WordPad is not bad for RTF codes styling, but it still does some weird things. For example, it defines fonts in every file that are the defaults, even if those fonts are not used in the file. And I have noticed that the use of linespacing codes is somewhat illogical, occuring on some paragraphs and not others.

Since the OP I have had some improved success using them in NeoBook by editing the RTF file afterward with Notepad. The first thing to do is remove all unused fonts and renumber the \f tags to point to the correct font. Then I remove all \sl240 and \sl276 codes, and remove all \slmult1 tags. The result in NeoBook is a stable display with single linespacing. Not the spacing I wanted, but it's stable so that's a positive step. The \sl276 code sets linespacing at 1.15 so I'll experiment with putting those codes back in an orderly way to see if I can bring back the 1.15 linespacing in a stable display. I guess I will also try the built-in editor and see if that does what I want.

So you may want to look at html as an alternative to RTF.

I have done that with other apps, but for this project I am creating a "portable" program with no external directories of stuff, and I really don't want to invoke an embedded instance of Internet Exploder.

I love using RTF files for help since they compile completely inside the pub. The internalized RTF help will be extensive, but the program will also point to complete help on the product website.

Thanks for the pointer to the built-in editor. Now I am curious to see the code it produces.
User avatar
Enigman
 
Posts: 314
Joined: Tue Apr 12, 2005 3:57 pm
Location: Foothill Ranch, CA

Re: RTF files have varying linespacing in NB

Postby Wrangler » Sun Oct 05, 2014 9:46 am

I really don't want to invoke an embedded instance of Internet Exploder


This would only happen if you used a web browser object somewhere in the pub. You also have the option to include the html template file in the distribution, read and replace variables in it, and then call it with the InternetLink action which would use the user's default browser to display it locally. Plus, if you were into making it look fancy, you have WAY more options to do so in html. But one must also be sure to replace code for any paths, such as images, so they display locally. Any of this can be done quickly and easily using the strreplace action.

In your case, you wouldn't use the html file as a template, but as the finished help file.

But you may also find the internal editor does the job for you....
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: 1505
Joined: Thu Mar 31, 2005 11:40 pm
Location: USA

Re: RTF files have varying linespacing in NB

Postby Enigman » Sun Oct 05, 2014 10:08 am

This would only happen if you used a web browser object somewhere in the pub. You also have the option to include the html template file in the distribution, ..... Any of this can be done quickly and easily using the strreplace action.....In your case, you wouldn't use the html file as a template, but as the finished help file.

Okay, but that's what I meant. I don't want to use a browser object. I'm also not doing anything like a template. I am creating a help system, so in order for me to use HTML and still be a portable file, I would have to embed hundreds of image and HTML files and then extract all of them at runtime. For a portable app, this would make it look like Pandora's box spewing pestilence onto the flash drive as soon as it is invoked. Not a good thing for a secure data manager. If I was building a normal "installed" program I could just have an HTML directory and use the default browser to call them from there. That's not my target here.

But you may also find the internal editor does the job for you....

I've been playing with it and one problem I see is that it seems to refuse to add a PNG image file. I choose to add an image, select the PNG file, and then ... nothing. No image comes in. I also opened the RTF code and ... wow ... there are massive amounts of codes repeated and repeated. That may not be bad, but it's a factor of ten higher than what WordPad inserts. Not being able to insert PNG files is a problem. I'll have to at least make the first pass at the RTF file in WordPad. Then I can open and resave it in the NB editor and see if the display is stable.

Thanks.
User avatar
Enigman
 
Posts: 314
Joined: Tue Apr 12, 2005 3:57 pm
Location: Foothill Ranch, CA

Re: RTF files have varying linespacing in NB

Postby Wrangler » Sun Oct 05, 2014 10:21 am

It's true. The neobook rtf editor will only accept bitmap images. What I do here is to use bitmaps whose background color matches the rtf background color, so no need for transparency. My biggest complaint about rtf is that it is word processor kind of based, one per line. You can't wrap text around an image, making the document long and sparse looking (some text, then an image, then more text). Some of it can be eliminated by using tables, but they are a pain in the butt using the neobook editor.

Pandora's box spewing pestilence onto the flash drive


:lol: Good way of putting it. But you're right.

Maybe embedding a .chm file in the project is the answer. There are a couple of good free chm help generators out there.....
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: 1505
Joined: Thu Mar 31, 2005 11:40 pm
Location: USA

Re: RTF files have varying linespacing in NB

Postby Enigman » Sun Oct 05, 2014 10:45 am

My biggest complaint about rtf is that it is word processor kind of based, one per line. You can't wrap text around an image

So far I am working around that limitation by using either large images that go completely across the page, or small icon sized button images.

Some of it can be eliminated by using tables

I hadn't thought of that in an RTF file.

Maybe embedding a .chm file in the project is the answer. There are a couple of good free chm help generators out there.....

I have a really good CHM editor, but again, I want to avoid having anything jump out of the portable file if possible. And, the help design here revolves around context sensitive help buttons found all over screens and dialogs ... FAST help, so you click a ? button and BANG it is on screen. That works great with the relatively small RTF files that display while still embedded.

Thanks.
User avatar
Enigman
 
Posts: 314
Joined: Tue Apr 12, 2005 3:57 pm
Location: Foothill Ranch, CA

Re: RTF files have varying linespacing in NB

Postby Tony Kroos » Sun Oct 05, 2014 10:59 am

It's hard to say something without being able to reproduce problem, but... WordPad may produce some dirty RTF code (especially after intensive visual editing) in your case. You may try to open your rtf file in notepad and manually clean extra "linespacing" tags, if found (they may be invisible in editor IDE or corrupted), or just try to create rtf from scratch and/or using another RTF editor (for ex. MS Word, but not recommended).
Tony Kroos
 
Posts: 402
Joined: Thu Oct 15, 2009 3:43 pm

Re: RTF files have varying linespacing in NB

Postby dpayer » Mon Oct 06, 2014 7:28 am

Just a reminder. You can make a very nice HTML page and then display it in IE. You then have the option to save this file as a 'compiled' MHT file which embeds all the related graphics and CSS files in the one .MHT file which can be used to display.

Very handy for help files.

David P.


Enigman wrote:
My biggest complaint about rtf is that it is word processor kind of based, one per line. You can't wrap text around an image

So far I am working around that limitation by using either large images that go completely across the page, or small icon sized button images.

Some of it can be eliminated by using tables

I hadn't thought of that in an RTF file.

Maybe embedding a .chm file in the project is the answer. There are a couple of good free chm help generators out there.....

I have a really good CHM editor, but again, I want to avoid having anything jump out of the portable file if possible. And, the help design here revolves around context sensitive help buttons found all over screens and dialogs ... FAST help, so you click a ? button and BANG it is on screen. That works great with the relatively small RTF files that display while still embedded.

Thanks.
David Payer
Des Moines, Iowa
USA
User avatar
dpayer
 
Posts: 1380
Joined: Mon Apr 11, 2005 5:55 am
Location: Iowa - USA

Re: RTF files have varying linespacing in NB

Postby Enigman » Mon Oct 06, 2014 7:47 am

Just a reminder. You can make a very nice HTML page and then display it in IE. You then have the option to save this file as a 'compiled' MHT file which embeds all the related graphics and CSS files in the one .MHT file which can be used to display.

That would be functionally similar to adding a CHM help file. What does one use to compile an MHT file?

Thanks.
User avatar
Enigman
 
Posts: 314
Joined: Tue Apr 12, 2005 3:57 pm
Location: Foothill Ranch, CA

Re: RTF files have varying linespacing in NB

Postby dpayer » Mon Oct 06, 2014 11:28 am

Enigman wrote:
Just a reminder. You can make a very nice HTML page and then display it in IE. You then have the option to save this file as a 'compiled' MHT file which embeds all the related graphics and CSS files in the one .MHT file which can be used to display.

That would be functionally similar to adding a CHM help file. What does one use to compile an MHT file?

Thanks.



Open the file in Internet Explorer. Make sure all the graphics display as desired. Then simply do a "SAVE AS" and select

web Archive - single file (*.mht)

as the type of file (in the dropdown).

It will save the page and all the graphics (not sure about all javascripts but you could save them in the file instead of referencing them) in one file.

index.htm ---> index.mht will show the same but the mht file is local. Test it out on a website.

David P
David Payer
Des Moines, Iowa
USA
User avatar
dpayer
 
Posts: 1380
Joined: Mon Apr 11, 2005 5:55 am
Location: Iowa - USA

Re: RTF files have varying linespacing in NB

Postby Enigman » Mon Oct 06, 2014 2:10 pm

Open the file in Internet Explorer. Make sure all the graphics display as desired. Then simply do a "SAVE AS" and select web Archive - single file (*.mht)

Ahhh ... okay. Then I am back to the original problem and the reason I am using RTF files. My help system is many many pages so I would need many many MHT files. Please refer back to my "Pandora's Box" comment previously. Before I would do many many MHTs I would do one CHM. But with RTFs there is no need to extract the files.

Thanks.
User avatar
Enigman
 
Posts: 314
Joined: Tue Apr 12, 2005 3:57 pm
Location: Foothill Ranch, CA

Re: RTF files have varying linespacing in NB

Postby dpayer » Mon Oct 06, 2014 3:12 pm

Enigman wrote:
Open the file in Internet Explorer. Make sure all the graphics display as desired. Then simply do a "SAVE AS" and select web Archive - single file (*.mht)

Ahhh ... okay. Then I am back to the original problem and the reason I am using RTF files. My help system is many many pages so I would need many many MHT files. Please refer back to my "Pandora's Box" comment previously. Before I would do many many MHTs I would do one CHM. But with RTFs there is no need to extract the files.

Thanks.


Well, it is possible to have one big page with many anchors to it that you can link to. Each "page" would look like its own resource, at the bottom of the help message on that page you could have a 'return to menu' link and then from there to any topic you wanted. The links show up very quickly and unless they scroll, they won' t know it is a big HTM file.

D
David Payer
Des Moines, Iowa
USA
User avatar
dpayer
 
Posts: 1380
Joined: Mon Apr 11, 2005 5:55 am
Location: Iowa - USA

Next

Return to General NeoBook Discussions

Who is online

Users browsing this forum: No registered users and 1 guest

cron