<!-- #INCLUDE FILE="../library/rtflib_20050408.asp" -->
<%
dim RTF_OUTPUT, tableWidth, CellWidth
RTF_OUTPUT = ""
Function Append(strContent)
'THIS FUNCTION SIMPLIFIES APPENDING CONTENT TO THE MAIN RTF_CONTENT STRING
RTF_OUTPUT = RTF_OUTPUT & strContent
end function
SetVerticalMeasure("inches")
SetHorizontalMeasure("inches")
'==================================================
Append DrawRTFHeader("Doc Title","Document Subject","Doc Author","Company","Document Comments",RTF_FONT_ARIAL,11,false,8.5,11,"1","1","1","1",RTF_PROTECTED)
'==================================================
call RegisterFont(RTF_FONT_ARIAL, "18", 0, RTF_BLUE)
Append(DrawParagraph("This demonstrates some of the RTF table features."))
Append(RTF_PARAGRAPH)
call RegisterTableSettings("c",null,null,null,null)
TableWidth = 5.5 //INCHES
call RegisterFont(RTF_FONT_ARIAL, "10", RTF_BOLD, RTF_BLUE)
call RegisterTableCell("This is some unformated (raw) text in a cell", TableWidth/3, "l", "t", null,null,null,null,null,null,null )
call RegisterTableCell(DrawChars("Some formated text, centered.",null,null,null,null), TableWidth/3, "c", "t", null,null,null,null,null,null,null )
call RegisterTableCell(DrawChars("Some formated text, right aligned.",null,null,null,null), TableWidth/3, "r", "t", null,null,null,null,null,null,null )
Append(DrawTableRow(false, true, null,null,null,null ))
call RegisterFont(RTF_FONT_ARIAL, "12", RTF_BOLD, RTF_DARK_GRAY)
call RegisterTableCell(DrawChars("This text should be JUSTIFIED. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec elementum, dolor vel aliquam tempus, ipsum diam sodales sem, ut faucibus urna lorem eget augue. Mauris mollis interdum metus. Pellentesque posuere tortor. Curabitur a quam quis tellus tincidunt blandit. Etiam justo. Integer eu tortor non neque fringilla commodo. Cras scelerisque fermentum nibh. Duis id elit. Etiam vehicula ultricies pede. ",null,null,null,null), TableWidth, "j", "t", null,null,null,null,null,null,null)
Append(DrawTableRow(false, true, null,null,null,null ))
call RegisterFont(RTF_FONT_ARIAL, "10", RTF_BOLD, RTF_RED)
call RegisterTableCell(DrawChars("Vertical Align Top.",null,null,null,null), TableWidth/4, "c", "t", null,null,null,null,null,null,null )
call RegisterTableCell(DrawChars("Vertical Align Middle.",null,null,null,null), TableWidth/4, "c", "c", null,null,null,null,null,null,null )
call RegisterTableCell(DrawChars("Vertical Align Bottom.",null,null,null,null), TableWidth/4, "c", "b", null,null,null,null,null,null,null )
call RegisterTableCell(DrawChars("This is just a spacer to create a large cell. This is just a spacer to create a large cell. ",null,null,null,null), TableWidth/4, "l", "t", null,null,null,null,null,null,null )
Append(DrawTableRow(false, true, null,null,null,null ))
call RegisterFont(RTF_FONT_ARIAL, "12", RTF_BOLD, RTF_YELLOW)
call RegisterTableCell(DrawChars("Black",null,null,null,null), TableWidth/5, "l", "t", RTF_BLACK,0, null,null,null,null,null)
call RegisterTableCell(DrawChars("Black 25% lighter",null,null,null,null), TableWidth/5, "l", "t", RTF_BLACK,25, null,null,null,null,null)
call RegisterTableCell(DrawChars("Black 50% lighter",null,null,null,null), TableWidth/5, "l", "t", RTF_BLACK,50, null,null,null,null,null)
call RegisterTableCell(DrawChars("Black 75% lighter",null,null,null,null), TableWidth/5, "l", "t", RTF_BLACK,75, null,null,null,null,null)
call RegisterTableCell(DrawChars("Black 100% lighter",null,null,null,null), TableWidth/5, "l", "t", RTF_BLACK,100, null,null,null,null,null)
Append(DrawTableRow(false, true, null,null,null,null ))
call RegisterFont(RTF_FONT_ARIAL, "12", RTF_BOLD, RTF_BLACK)
call RegisterTableCell(DrawChars("Blue",null,null,null,null), TableWidth/5, "l", "t", RTF_BLUE,0, null,null,null,null,null)
call RegisterTableCell(DrawChars("Blue 25% lighter",null,null,null,null), TableWidth/5, "l", "t", RTF_BLUE,25, null,null,null,null,null)
call RegisterTableCell(DrawChars("Blue 50% lighter",null,null,null,null), TableWidth/5, "l", "t", RTF_BLUE,50, null,null,null,null,null)
call RegisterTableCell(DrawChars("Blue 75% lighter",null,null,null,null), TableWidth/5, "l", "t", RTF_BLUE,75, null,null,null,null,null)
call RegisterTableCell(DrawChars("Blue 100% lighter",null,null,null,null), TableWidth/5, "l", "t", RTF_BLUE,100, null,null,null,null,null)
Append(DrawTableRow(false, true, null,null,null,null ))
call RegisterFont(RTF_FONT_ARIAL, "12", RTF_BOLD, RTF_YELLOW)
call RegisterTableCell(DrawChars("Blue",null,null,null,null), TableWidth/5, "l", "t", RTF_BLUE,0, null,null,null,null,null)
call RegisterTableCell(DrawChars("Blue 25% darker",null,null,null,null), TableWidth/5, "l", "t", RTF_BLUE,-25, null,null,null,null,null)
call RegisterTableCell(DrawChars("Blue 50% darker",null,null,null,null), TableWidth/5, "l", "t", RTF_BLUE,-50, null,null,null,null,null)
call RegisterTableCell(DrawChars("Blue 75% darker",null,null,null,null), TableWidth/5, "l", "t", RTF_BLUE,-75, null,null,null,null,null)
call RegisterTableCell(DrawChars("Blue 100% darker",null,null,null,null), TableWidth/5, "l", "t", RTF_BLUE,-100, null,null,null,null,null)
Append(DrawTableRow(false, true, null,null,null,null))
call RegisterFont(RTF_FONT_ARIAL, "10", RTF_ITALIC, RTF_DARK_GRAY)
call RegisterTableCell(DrawChars("auto-generating the next set of cells using loops.", null,null,null,null), TableWidth, "l", "t", null,null,null,null,null,null,null)
Append(DrawTableRow(false, true, null,null,null,null))
call RegisterFont(RTF_FONT_ARIAL, "10", 0, RTF_BLACK)
dim NumColumns, NumRows, i, iRow, iCol
NumColumns = 9
'USE A SINGLE LOOP TO CREATE THE HEADER CELLS
for i=1 to NumColumns
call RegisterTableCell(DrawChars("Header Cell " & i, NULL,NULL,NULL,NULL), TableWidth/NumColumns, "c", "t", RTF_BLACK, 25, null, null, null, null, null )
next
Append DrawTableRow(false, true, NULL,NULL,NULL,NULL)
NumRows = 5
'USE NESTED LOOPS FOR MULTIPLE ROWS
for iRow=1 TO NumRows
for iCol=1 TO NumColumns
call RegisterTableCell(DrawChars(iCol, NULL,NULL,NULL,NULL), TableWidth/NumColumns, "c", "c", null, null, null, null, null, null, null )
next
Append DrawTableRow(false, true, NULL,NULL,NULL,NULL)
next
'==================================================
Append DrawRTFFooter()
'==================================================
Response.ContentType="application/rtf"
Response.AddHeader "content-disposition", "filename=sample.rtf"
Response.Write RTF_OUTPUT
%>