Results 1 to 5 of 5

Thread: Merge HTML Files.

  1. #1

    Thread Starter
    Fanatic Member vijy's Avatar
    Join Date
    May 2007
    Location
    India
    Posts
    548

    Merge HTML Files.

    Has anyone tried merging multiple HTML Files to single HTML File ?

    am in confusion whether we need to treat HTML files as an ordinary text and and to append text or is there anyother way..
    Visual Studio.net 2010
    If this post is useful, rate it


  2. #2
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Merge HTML Files.

    There is nothing magical or mysterious about HTML files... they are plain text. Ever open one up in Notepad?

    As for appending... sure, you could just append to the end of the file... but you have to keep in mind the closing tags of one file and the opening tags of the other...

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3
    PowerPoster cicatrix's Avatar
    Join Date
    Dec 2009
    Location
    Moscow, Russia
    Posts
    3,654

    Re: Merge HTML Files.

    A html file consists of the following sections:

    HTML Code:
    <HTML> 
     <HEAD>
        Header section
     </HEAD>
     <BODY>
        Whatever you want - it's the body. Here is where actual contents go.
     </BODY>
    </HTML>
    Everything that goes below </HTML> will be ignored by browser.
    So, to merge two HTML files you have to actually merge their <BODY> sections, not whole files.

  4. #4

    Thread Starter
    Fanatic Member vijy's Avatar
    Join Date
    May 2007
    Location
    India
    Posts
    548

    Re: Merge HTML Files.

    I need some fast approach to merge the contents because the number of HTML file count is morethan 1000 files..
    Visual Studio.net 2010
    If this post is useful, rate it


  5. #5
    PowerPoster cicatrix's Avatar
    Join Date
    Dec 2009
    Location
    Moscow, Russia
    Posts
    3,654

    Re: Merge HTML Files.

    1. Open a source file 1 (File1)
    2. Grab everything between <BODY> ... </BODY> in the File 1 (data1)
    3. Open a source file 2 (File2)
    4. Grab everything between <BODY> .. </BODY> in the File 2 (data2)
    5. Open a target file
    6. Write to a target file either the header from File1 or File2 (depending on your needs) or write your own header
    7. Write the combined (data1 + data2) into the target file
    8. Close the target file with </BODY></HTML>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width