7 Private Sub Class_Initialize
\r
8 set attr = CreateObject("Scripting.Dictionary")
\r
11 Private Sub Class_Terminate
\r
15 Public Function HeadingCell()
\r
19 If attr.exists("colspan") Then
\r
20 span=attr("colspan")
\r
21 s=s & " colspan='" & span & "'"
\r
23 HeadingCell = Array(s & "><div class='ricoLG_col'>" & DataCell("") & "</div></td>", span)
\r
26 Public Function DataCell(rowclass)
\r
29 attr("class")=trim("ricoLG_cell " & attr("class") & " " & rowclass)
\r
30 for each k in attr.keys
\r
31 If k<>"colspan" Then s=s & " " & k & "='" & attr(k) & "'"
\r
33 s=s & ">" & content & "</div>"
\r
37 Public Function HtmlCell()
\r
40 for each k in attr.keys
\r
41 s=s & " " & k & "='" & attr(k) & "'"
\r
43 s=s & ">" & content & "</td>"
\r
47 Public Sub SetAttr(name,value)
\r
55 private attr, CurrentCell
\r
57 Private Sub Class_Initialize
\r
59 set attr = CreateObject("Scripting.Dictionary")
\r
62 Private Sub Class_Terminate
\r
66 Public Sub AddCell(ByVal content)
\r
67 ReDim Preserve cells(ubound(cells)+1)
\r
68 set CurrentCell=new SimpleGridCell
\r
69 set cells(ubound(cells))=CurrentCell
\r
70 CurrentCell.content=content
\r
73 Public Function HeadingRow(ByVal c1, ByVal c2)
\r
74 dim cellidx,colidx,s,a
\r
77 while colidx < c1 and cellidx <= ubound(cells)
\r
78 a=cells(cellidx).HeadingCell()
\r
79 colidx=colidx+CInt(a(1))
\r
82 while (colidx <= c2) and cellidx <= ubound(cells)
\r
83 a=cells(cellidx).HeadingCell()
\r
85 colidx=colidx+CInt(a(1))
\r
91 Public Function HeadingClass()
\r
92 HeadingClass=trim("ricoLG_hdg " & attr("class"))
\r
95 Public Function CellCount()
\r
96 CellCount=ubound(cells)+1
\r
99 Public Function GetRowAttr(ByVal name)
\r
100 GetRowAttr=attr(name)
\r
103 Public Sub SetRowAttr(ByVal name, ByVal value)
\r
107 Public Sub SetCellAttr(ByVal name, ByVal value)
\r
108 CurrentCell.SetAttr name,value
\r
115 private LastRow,LastHeadingRow,ResizeRowIdx
\r
117 Private Sub Class_Initialize
\r
121 Public Function AddHeadingRow(ResizeRowFlag)
\r
122 LastHeadingRow=AddDataRow
\r
123 if ResizeRowFlag then ResizeRowIdx=LastHeadingRow
\r
124 AddHeadingRow=LastHeadingRow
\r
127 Public Function AddDataRow()
\r
128 ReDim Preserve rows(ubound(rows)+1)
\r
129 set rows(ubound(rows))=new SimpleGridRow
\r
130 LastRow=ubound(rows)
\r
134 Public Function HeadingRowCount()
\r
135 if IsEmpty(LastHeadingRow) then
\r
138 HeadingRowCount=LastHeadingRow+1
\r
142 Public Function DataRowCount()
\r
143 if IsEmpty(LastRow) then
\r
146 DataRowCount=LastRow+1-HeadingRowCount()
\r
150 ' returns # of cells in the current row
\r
151 Public Function CellCount()
\r
152 CellCount=rows(LastRow).CellCount
\r
155 Public Sub AddCell(ByVal content)
\r
156 rows(LastRow).AddCell content
\r
159 Public Sub AddCellToRow(ByVal RowIdx, ByVal content)
\r
164 Public Sub SetRowAttr(ByVal name, ByVal value)
\r
165 rows(LastRow).SetRowAttr name,value
\r
168 Public Sub SetCellAttr(ByVal name, ByVal value)
\r
169 rows(LastRow).SetCellAttr name,value
\r
172 Private Function RenderColumns(ByVal c1, ByVal c2)
\r
175 response.write vbLf & "<td><div class='ricoLG_col'>"
\r
176 for r=LastHeadingRow+1 to ubound(rows)
\r
177 response.write rows(r).cells(c).DataCell(rows(r).GetRowAttr("class"))
\r
179 response.write "</div></td>"
\r
183 ' Response.Buffer must be true
\r
184 Public Sub RenderExcel(fileName)
\r
187 if fileName<>"" then Response.AddHeader "content-disposition", "attachment; filename=" & fileName
\r
188 'Response.ContentType = "application/vnd.ms-excel"
\r
189 Response.ContentType = "application/ms-excel"
\r
191 response.write vbLf & "<table>"
\r
192 for r=0 to ubound(rows)
\r
193 response.write vbLf & "<tr>"
\r
194 for c=0 to ubound(rows(r).cells)
\r
195 response.write rows(r).cells(c).HtmlCell
\r
197 response.write vbLf & "</tr>"
\r
199 response.write vbLf & "</table>"
\r
203 ' Response.Buffer must be true
\r
204 Public Sub RenderDelimited(fileName,delim,SubstituteChar)
\r
207 if fileName<>"" then Response.AddHeader "content-disposition", "attachment; filename=" & fileName
\r
208 Response.ContentType = "text/csv"
\r
210 for r=0 to ubound(rows)
\r
211 for c=0 to ubound(rows(r).cells)
\r
212 if c > 0 then response.write delim
\r
213 response.write replace(rows(r).cells(c).content,delim,SubstituteChar)
\r
215 response.write vbLf
\r
220 Public Sub Render(ByVal id, FrozenCols)
\r
222 if IsEmpty(ResizeRowIdx) then exit sub
\r
223 colcnt=rows(ResizeRowIdx).CellCount
\r
224 response.write vbLf & "<div id='" & id & "_outerDiv'><table id='" & id & "' border='0' cellspacing='0' cellpadding='0'><tr valign='top'><td rowspan='2'>"
\r
226 '-------------------
\r
228 '-------------------
\r
230 response.write vbLf & "<table id='" & id & "_tab0h' class='ricoLG_table ricoLG_top ricoLG_left' cellspacing='0' cellpadding='0'><thead>"
\r
231 for r=0 to LastHeadingRow
\r
232 response.write vbLf & "<tr class='" & rows(r).HeadingClass & "'"
\r
233 if r=ResizeRowIdx then response.write " id='" & id & "_tab0h_main'"
\r
235 response.write rows(r).HeadingRow(0,FrozenCols-1)
\r
236 response.write vbLf & "</tr>"
\r
238 response.write vbLf & "</thead></table>"
\r
241 response.write vbLf & "<div id='" & id & "_frozenTabsDiv'>"
\r
242 response.write "<table id='" & id & "_tab0' class='ricoLG_table ricoLG_bottom ricoLG_left' cellspacing='0' cellpadding='0'>"
\r
243 response.write vbLf & "<tr>"
\r
244 RenderColumns 0,FrozenCols-1
\r
245 response.write vbLf & "</tr>"
\r
246 response.write vbLf & "</table>"
\r
248 response.write vbLf & "</div></td>"
\r
251 '-------------------
\r
252 ' scrolling columns
\r
253 '-------------------
\r
256 response.write vbLf & "<td><div id='" & id & "_innerDiv'>"
\r
257 response.write vbLf & "<div id='" & id & "_scrollTabsDiv'>"
\r
258 response.write vbLf & "<table id='" & id & "_tab1h' class='ricoLG_table ricoLG_top ricoLG_right' cellspacing='0' cellpadding='0'><thead>"
\r
259 for r=0 to LastHeadingRow
\r
260 response.write vbLf & "<tr class='" & rows(r).HeadingClass & "'"
\r
261 if r=ResizeRowIdx then response.write " id='" & id & "_tab1h_main'"
\r
263 response.write rows(r).HeadingRow(FrozenCols,colcnt-1)
\r
264 response.write vbLf & "</tr>"
\r
266 response.write vbLf & "</thead></table>"
\r
267 response.write vbLf & "</div>"
\r
268 response.write vbLf & "</div>"
\r
271 response.write vbLf & "<tr valign='top'><td><div id='" & id & "_scrollDiv'>"
\r
272 response.write vbLf & "<table id='" & id & "_tab1' class='ricoLG_table ricoLG_bottom ricoLG_right' cellspacing='0' cellpadding='0'>"
\r
273 response.write vbLf & "<tr>"
\r
274 RenderColumns FrozenCols,colcnt-1
\r
275 response.write vbLf & "</tr>"
\r
276 response.write vbLf & "</table>"
\r
277 response.write vbLf & "</div></td></tr>"
\r
279 response.write vbLf & "</table></div>"
\r