PC Review


Reply
Thread Tools Rate Thread

Code to read and convert txt file

 
 
Matthew Schwarz
Guest
Posts: n/a
 
      21st Jun 2008
I use txt files to make news pages on my web site. The first line is the
title. The second line is the author. The third line is the date. The fourth
line through the end is the body of the story.

I'd like to be able to convert these text files into an htm template I have
with some htm code before the news story, a certain font style for the each
of the first line, the second line, the third line and remaining lines, and
then code after the story.

I've search high and low looking for a txt to htm converter and some are
promising though none can do exactly what I need.

Does anyone know one that can do this?

How about some visual basic code to run a macro within Frontpage? Basically
it would have to detect each line separated by a carriage return.

Thank you very much.
Matt
 
Reply With Quote
 
 
 
 
Matthew Schwarz
Guest
Posts: n/a
 
      28th Jun 2008
Hello,
Just wondering if anyone had any thoughts on this.

Basically, the best way I could imagine this is I open up a txt file from
within Frontpage, run a macro that does the following:

- Add header html code
- Take first line until first carriage return and put such and such tags
around it
- Take next line until next carriage return and put other tags
- Take next line until next carriage return and put other tages
- Take remaining text with a certain font styling
- Add footer html code

Does anyone have any ideas on how to implement something like this in VBA?
Or maybe someone can point me in the direction of a web site or an add-in
that does something similiar?
Thank you very much.
 
Reply With Quote
 
Stefan B Rusynko
Guest
Posts: n/a
 
      28th Jun 2008
In FP VBA help search for OpenTextFile Method and OpenAsTextStream Method then use the ReadLine for each line of the text file

--

_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
_____________________________________________


"Matthew Schwarz" <(E-Mail Removed)> wrote in message
news:F011C74A-3F69-4402-BF31-(E-Mail Removed)...
| Hello,
| Just wondering if anyone had any thoughts on this.
|
| Basically, the best way I could imagine this is I open up a txt file from
| within Frontpage, run a macro that does the following:
|
| - Add header html code
| - Take first line until first carriage return and put such and such tags
| around it
| - Take next line until next carriage return and put other tags
| - Take next line until next carriage return and put other tages
| - Take remaining text with a certain font styling
| - Add footer html code
|
| Does anyone have any ideas on how to implement something like this in VBA?
| Or maybe someone can point me in the direction of a web site or an add-in
| that does something similiar?
| Thank you very much.


 
Reply With Quote
 
trochia
Guest
Posts: n/a
 
      29th Jun 2008
MAtt, I also saw your post on get a freelancer...

I don't have my Visual Studio 2003.net loaded anymore, ( had a box crash
on my development PC awhile back)...and have reloadedbut maybe this helps
some?

http://www.softpanorama.org/Office/F...e_macros.shtml

(E-Mail Removed)

"Matthew Schwarz" wrote:

> I use txt files to make news pages on my web site. The first line is the
> title. The second line is the author. The third line is the date. The fourth
> line through the end is the body of the story.
>
> I'd like to be able to convert these text files into an htm template I have
> with some htm code before the news story, a certain font style for the each
> of the first line, the second line, the third line and remaining lines, and
> then code after the story.
>
> I've search high and low looking for a txt to htm converter and some are
> promising though none can do exactly what I need.
>
> Does anyone know one that can do this?
>
> How about some visual basic code to run a macro within Frontpage? Basically
> it would have to detect each line separated by a carriage return.
>
> Thank you very much.
> Matt

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how do I print to file and convert same file so it can be read? =?Utf-8?B?ZnJlZHpv?= Microsoft Outlook Calendar 2 11th Feb 2007 03:53 PM
excel 2002 -how can you convert a file to a pdf read only file? =?Utf-8?B?c3B1bmt5ZjE1?= Microsoft Excel Misc 4 29th Sep 2006 09:36 PM
read or convert xml file to a string Jon Paal Microsoft ASP .NET 9 26th Jan 2006 04:06 AM
Re: Convert a Read Only file Graham Mayor Microsoft Word New Users 7 23rd Sep 2004 08:41 PM
Convert a Read Only file =?Utf-8?B?RGVubmlzIEJlYWNo?= Microsoft Word New Users 0 22nd Sep 2004 02:39 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:19 AM.