Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 8 of 8
  1. #1
    Join Date
    Oct 2003
    Location
    West Monroe, LA
    Posts
    294

    Create and Print XML or HTM

    I have created a project for my sons Tiger Scouts that tracks their progress in achievements. The achievements and dates are in a INI file.

    One of their requirements is for them to print a document they typed.
    So what I have done is allow them to type a message and store this also in the INI file.

    What I would like to do is display this data in an attractive way and print this document to the users printer.

    I understand how to read the INI for data and I have the XML plug in, but I
    DONOT know how to get the data into the format I'm looking for.

    Any helpful ideas or tips???

    Mark

  2. #2
    Josué Alba Guest
    well in fact I done something like this, and never discovered a way to do this with ams so I use a template on a swf, the app loads the correct text and it sends to the printer.

    Please check the fla files.
    the v3 is the one that loads the txt file and the impresion moves the clip for a printer error control.
    Last edited by Josué Alba; 10-25-2004 at 08:10 PM.

  3. #3
    Join Date
    Dec 2003
    Location
    Location! Location!
    Posts
    6,137
    Well, if you have the SQLite plugin (or were wanting for a reason to buy such) then you may be interested in this link.

    http://www.indigorose.com/forums/sho...=formated+file

    Or, you can setup a HTML (.htm or .html) file to hold the data you want. Use place holders (###sonsreport###) for the data you want to inject (replacing the place holder ###sonsreport### with the actual report ini data)

    (Hint: String.Find and then String.Replace)

    To format the data you could put the place holder (again, ###sonsreport###) into one of several cells in a Table.

    I hope this gets the juices flowing. Otherwise, someone might just come by with a lovely example (I am pretty busy tonight, sorry).
    Intrigued

  4. #4
    Josué Alba Guest
    Well actually what i understood was thar mark want a preformated page to print on a pre-printed paper like a tiket or something like that. The example I send does that, if it's not the idea sorry I missunderstood

  5. #5
    Join Date
    Dec 2003
    Location
    Location! Location!
    Posts
    6,137
    Create and Print XML or HTM is what I saw in the thread title.

    But, the way I look at it is... the more (and different ways) examples the better! I like Flash, so you know I'm going to take a look at what you put out, when I get some time.

    ps. The smilies get rearranged? (they seem in a different order, who's testing us?)
    Intrigued

  6. #6
    Join Date
    Oct 2003
    Location
    West Monroe, LA
    Posts
    294
    I do have the sql Plugin and have never used it yet either. Is it pretty easy to do?

    I need to read from the INI file and basically print the info in a nice format. No pre printed sheet.

    Any help is appreciated.

    Mark

  7. #7
    Join Date
    Dec 2003
    Location
    Location! Location!
    Posts
    6,137
    There are several examples spread around over the Search Forum (click the Search link in the menu bar up above)

    But, here is one to get you started:

    http://www.indigorose.com/forums/sho...ghlight=sqlite
    Intrigued

  8. #8
    Join Date
    Sep 2002
    Location
    Sol 3
    Posts
    3,160
    Quote Originally Posted by markstaylor
    I do have the sql Plugin and have never used it yet either. Is it pretty easy to do?

    I need to read from the INI file and basically print the info in a nice format. No pre printed sheet.

    Any help is appreciated.

    Mark
    What you are looking to do is relatively easy to do. Once you have read in all the information from the INI file or database you can then use functions to output to an HTML file. I am currently using the following functions found on this forum. This allows me to create html pages dynamically and then print them. I am currently using them to create reports or a friend of mine based on sales she has at her salon. I hope you find these useful.

    Code:
    -- HTML Colors
    -- White = #FFFFFF
    -- Grey 25 = #C0C0C0
    -- Grey 40 = #999999
    -- Grey 50 = #808080
    -- Grey 80 = #333333
    -- Black = #000000
    
    	function CreatePage(strTitle, strBColor)
    		local String1 = ""
    		String1 = String1 ..	'<html>' ..
    								'<head>' ..
    								'<title>'.. strTitle ..'</title>' ..
    								'</head>' ..
    								'<body bgcolor="'..strBColor..'" text="black">' ;
    		return String1;
    	end
    	
    	
    	function DestroyPage()
    		return '</body></html>'
    	end
    	
    	
    	function Header(sText, nSize)
    		return '<H' .. nSize+1 .. '><font face="Verdana, Arial">' .. sText .. '</font></h' .. nSize .. '>' .. "\r\n";
    	end
    	
    	
    	function CreateTable(nBorder)
    		return '<table border='..nBorder..', width="100%" cellpadding=5, cellspacing=0>' .. "\r\n";
    	end
    
    
    
    	function TableItem(sDate, sService, sCost, sDescription)
    		return '<tr><td valign="top" width="25%" bgcolor="lightgrey"><font face="Verdana, Arial">' .. sDate .. '</font></td><td width="20%"><font face="Verdana, Arial">' .. sService .. '</font></td><td width="15%"><font face="Verdana, Arial">' .. sCost .. '</font></td><td width="40%"><font face="Verdana, Arial">' .. sDescription .. '</font></td></tr>' .. "\r\n";
    	end
    
    	function TableReportItem(sBColor, sMonth, sSubTotal, sTax, sTip, sTotal)
    		--return '<tr  bgcolor="'..sBColor..'"><td valign="top" width="20%"><font face="Verdana, Arial">' .. sMonth .. '</font></td><td width="20%"><font face="Verdana, Arial">' .. sSubTotal .. '</font></td><td width="20%"><font face="Verdana, Arial">' .. sTax .. '</font></td><td width="20%"><font face="Verdana, Arial">' .. sTip .. '</font></td><td width="20%"><font face="Verdana, Arial">' .. sTotal .. '</font></td></tr>' .. "\r\n";
    		return '<tr  bgcolor="'..sBColor..'"><td valign="top" width="20%">' .. sMonth .. '</td><td width="20%">' .. sSubTotal .. '</td><td width="20%">' .. sTax .. '</td><td width="20%">' .. sTip .. '</td><td width="20%">' .. sTotal .. '</td></tr>' .. "\r\n";
    	end
    	
    	function TableSalesItemHeader(sBColor, sDate, sService, sCost)
    		return '<tr bgcolor="'..sBColor..'"><td valign="top" width="25%"><b><font face="Verdana, Arial">' .. sDate .. ':' .. '</font></b></td><td width="60%"><b><font face="Verdana, Arial">' .. sService .. '</font></b></td><td width="15%"><b><font face="Verdana, Arial">' .. sCost .. '</font></b></td></tr>' .. "\r\n";
    	end
    
    	function TableSalesItem(sBColor, sDate, sService, sCost)
    		return '<tr bgcolor="'..sBColor..'"><td valign="top" width="25%"><font face="Verdana, Arial">' .. sDate .. '</font></td><td width="60%"><font face="Verdana, Arial">' .. sService .. '</font></td><td width="15%" align="right"><font face="Verdana, Arial">' .. sCost .. '</font></td></tr>' .. "\r\n";
    	end
    	
    	function TableSalesItemTally(sBColor, sService, sCost)
    		return '<tr bgcolor="'..sBColor..'"><td valign="top" colspan=2 align="right"><b><font face="Verdana, Arial">' .. sService .. ':' .. '</font></b></td><td width="15%" align="right"><font face="Verdana, Arial">' .. sCost .. '</font></td></tr>' .. "\r\n";
    	end
    	
    	function DestroyTable()
    		return '</table><br><br><br>' .. "\r\n";
    	end
    	
    	
    	function TableHeader(sHeader, nColspan, sBColor)
    		if sBColor == nil then
    			sBColor = "#000000";
    		end
    		return '<tr><td colspan="'..nColspan..'" valign="top" bgcolor="'..sBColor..'"><font color="#FFFFFF" size="+1" face="Verdana, Arial"><I>' .. sHeader .. '</i></font></td></tr>' .. "\r\n";
    	end
    Probably not as clean as what someone else would do but it works for me. Here is a samle of how I would build a page.

    Code:
    strHTML = CreatePage("Tara's Hair Salon Receipt","#FFFFFF");
    strHeader = TextFile.ReadToString("AutoPlay\\Docs\\header.txt");
    strHeader = String.Replace(strHeader, "\r\n", "<br>", false);
    strHTML = strHTML .. '<center>'..strHeader..'<hr></center>'.."\r\n"..
    	'<br>'.."\r\n"..
    	'<br>'.."\r\n"..
    	strfirstname.." "..strLastname.."\r\n"..
    	strAddress1.."\r\n"..
    	strCity..strState..strZip.."\r\n"..
    	'<br>'.."\r\n"
    strHTML = strHTML .. CreateTable(0);
    strHTML = strHTML .. TableSalesItemHeader("#999999", "Date", "Description", "Charge");
    strHTML = strHTML..TableSalesItem(strBackGround, strDate, lb2text, string.format("%.2f", lb2data));
    strHTML = strHTML .. TableSalesItemTally("#999999", "Subtotal", FormatCurrency(nSubTotal));
    strHTML = strHTML .. TableSalesItemTally("#999999", "Tax", FormatCurrency(Math.Round(nTotal - nSubTotal,2)));
    strHTML = strHTML .. TableSalesItemTally("#999999", "Total", FormatCurrency(nTotal));
    strHTML = strHTML .. TableSalesItemTally("#999999", "Paid by "..strPayment, FormatCurrency(nTended));
    strHTML = strHTML .. DestroyTable();
    local strFooter = TextFile.ReadToString("AutoPlay\\Docs\\footer.txt");
    strFooter = String.Replace(strFooter, "\r\n", "<br>", false);
    strHTML = strHTML .. '<center><hr>'..strFooter..'</center>'..DestroyPage();
    strTimeStamp = System.GetDate(DATE_FMT_ISO)..System.GetTime(TIME_FMT_HOUR)..System.GetTime(TIME_FMT_MIN)..System.GetTime(TIME_FMT_SEC);
    TextFile.WriteFromString(_TempFolder.."\\THSReceipt"..strTimeStamp..".html", strHTML, false);
    File.OpenURL(_TempFolder.."\\THSReceipt"..strTimeStamp..".html", SW_SHOWNORMAL);
    I appologize that it is not commented but in short is uses the above functions to create a receipt for her customers.

    HTH

    You may want to look at the project SQLite to HTML to get more ideas.

    Tigg
    TJ-Tigger
    "A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools."
    "Draco dormiens nunquam titillandus."
    Map of IR Forum Users - IR Project CodeViewer - Online Help - TiggTV - QuizEngine

Similar Threads

  1. Can you print your project pages?
    By webnc1 in forum AutoPlay Media Studio 5.0
    Replies: 1
    Last Post: 10-05-2004, 02:11 PM
  2. Formatting variables for print
    By Scally in forum AutoPlay Media Studio 4.0
    Replies: 13
    Last Post: 02-19-2003, 08:52 AM

Posting Permissions

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