![]() |
Heres what I'm wanting to do. Theres a certain part of the HTML file where all the text is..I want a vb program to be able to open that part of the text and edit it, and place it back into the html file..
Get what I'm saying? Thanks |
hmm maybe you could somethign with like a place holder, to sort of make a template in a way.
e.g. Template.html :
<html>And then the program could open up the templace file, and just replace the {TEXT} with the actual text and then resave it as the real HTML page. |
What i would do is have a set of html comments, one for the start of the text area and one to end it. Then just have the vb code search for these strings (the html comments) and throw the text in between the comments. So your html file would llook somthing liek this:
:
<html> |
the HTML part is easy, I know how to do that.
But I don't know how to get say a textbox in VB to search for that particular part of the html document |
The text box doesn't search the file - your code does.
First, open the file for reading. Then parse it, line by line, into a string array, checking each one for the starting comment as you go. When you reach the comments, make a note of the line number. Then parse the bits between the comments, but don't save it into the array. When you reach the ending comment, start saving it again, until you reach the end of the file. Next, open the file for output. Until you get to the comment (you stored the line number earlier), just output the string line by line. When you do, output the stuff you want. Then send the bottom bit (the ending comment onwards). And voila! You're done! I realise you might not know how to do some (or any) of this. If there's anything you need help with, please post back. |
Herečs a function that will return the text between your two markers.
:
function grabtext(filename, search as string) as variantAnyways, this code has not been tested yet at all, so there could be bugs in it. Good luck. |
I'll run it through the garden this weekend... I think I may have a use for something similar.
|
Has anybody tested that code? i will somtime today if need be.
|
| All times are GMT -5. The time now is 1:02 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC