Alpha DevCon 2018
Results 1 to 3 of 3

Thread: How To: combine 2 html files into 1 file using xbasic

  1. #1
    "Certified" Alphaholic
    Real Name
    Ronald Anusiewicz
    Join Date
    Oct 2000
    Location
    Southampton, MA
    Posts
    1,492

    Default How To: combine 2 html files into 1 file using xbasic

    I have two different reports, index1.html and index2.html.

    Is is possible using xbasic to combine the 2 files together into 1 file, index.html?
    Alpha Anywhere v3.5
    Version 12.3, Build 2999
    MySql56 & DBF's

    Alpha 4, 5, Anywhere

    Ron Anusiewicz

  2. #2
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,011

    Default Re: How To: combine 2 html files into 1 file using xbasic

    GET_FROM_FILE() and SAVE_TO_FILE()?

    That seems to work but the reports are overlaid instead of one appended to the other consecutively. Not good.

    Advice I found googling seems to indicate that one would need to read the "top" file up to and including the <body> tag. Save that. Read the contents between <body> ...</body> and append that to the saved file. Read the contents of the "bottom" file, between<body> ...</body>, append that to the saved file. Then read the "top" file from </body> to the end, and write that to the saved file.
    Last edited by Stan Mathews; 11-20-2017 at 01:27 PM.
    There can be only one.

  3. #3
    "Certified" Alphaholic
    Real Name
    Ronald Anusiewicz
    Join Date
    Oct 2000
    Location
    Southampton, MA
    Posts
    1,492

    Default Re: How To: combine 2 html files into 1 file using xbasic

    Thanks Stan,

    Actually, it works just fine. I used the Layout version of reports and they are being saved as html.
    I believe that means the reports are just text. So when I combine them together, it's just one long text document.
    The text file is saved with the .html extension and opens up in a browser just fine.


    Code:
    x = :report.SaveAs("Item_Tmp_WEB_Report","HTML","","",vFilename+"1.HTML")
    y = :report.SaveAs("Item_Tmp_WEB_Items","HTML","","",vFilename+"2.HTML")
    	
    dim rpt1 as C
    dim rpt2 as C
    	
    rpt1 = get_from_file(vFilename + "1.html")
    rpt2 = get_from_file(vFilename + "2.html")
    	
    save_to_file(rpt2 + crlf() + rpt1, vFilename + ".html")
    Last edited by Ronald Anusiewicz; 11-20-2017 at 01:52 PM. Reason: added code
    Alpha Anywhere v3.5
    Version 12.3, Build 2999
    MySql56 & DBF's

    Alpha 4, 5, Anywhere

    Ron Anusiewicz

Similar Threads

  1. convert pdf file to html - is there a way with Xbasic?
    By drgarytraub in forum Mobile & Browser Applications
    Replies: 5
    Last Post: 12-21-2015, 12:08 PM
  2. Combine my web components with my HTML
    By Corinthian in forum Application Server Version 10 - Web/Browser Applications
    Replies: 2
    Last Post: 11-18-2010, 05:21 PM
  3. Combine HTML for Submit and HTML to go to target page
    By iviowa in forum Application Server Version 8
    Replies: 1
    Last Post: 10-07-2008, 01:45 PM
  4. programmatically combine pdf files into one file?
    By David Brown in forum Alpha Five Version 6
    Replies: 2
    Last Post: 02-18-2005, 05:48 AM

Bookmarks

Posting Permissions

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