Changeset 65 for trunk/Components/CoolWeb/Common/UHtmlClasses.pas
- Timestamp:
- Dec 19, 2011, 3:48:33 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Components/CoolWeb/Common/UHtmlClasses.pas
r61 r65 175 175 Styles: TStringList; 176 176 Scripts: TStringList; 177 property AsXmlDocument: TXmlDocument read GetAsXmlDocument; 178 constructor Create; 179 destructor Destroy; override; 180 end; 181 182 { THtmlCell } 183 184 THtmlCell = class(THtmlElement) 185 RowSpan: Integer; 186 ColSpan: Integer; 187 Value: THtmlElement; 188 constructor Create; 189 end; 190 191 { THtmlRow } 192 193 THtmlRow = class(THtmlElement) 194 Cells: TListObject; // TListObject<THtmlCell> 195 constructor Create; 196 destructor Destroy; override; 197 end; 198 199 { THtmlTable } 200 201 THtmlTable = class 202 private 203 function GetAsXmlDocument: TXmlDocument; 204 public 205 Rows: TListObject; // TListObject<THtmlRow> 177 206 property AsXmlDocument: TXmlDocument read GetAsXmlDocument; 178 207 constructor Create; … … 247 276 Result := False; 248 277 end; 278 end; 279 280 { THtmlCell } 281 282 constructor THtmlCell.Create; 283 begin 284 ColSpan := 1; 285 RowSpan := 1; 286 end; 287 288 { THtmlRow } 289 290 constructor THtmlRow.Create; 291 begin 292 Cells := TListObject.Create; 293 end; 294 295 destructor THtmlRow.Destroy; 296 begin 297 Cells.Free; 298 inherited Destroy; 299 end; 300 301 { THtmlTable } 302 303 function THtmlTable.GetAsXmlDocument: TXmlDocument; 304 var 305 Row, Column: Integer; 306 begin 307 with TXmlTag(Result) do begin 308 Name := 'table'; 309 for Row := 0 to Rows.Count - 1 do 310 with TXmlTag(SubElements.AddNew(TXmlTag.Create)) do begin 311 Name := 'tr'; 312 for Column := 0 to THtmlRow(Rows[Row]).Cells.Count - 1 do 313 with TXmlTag(SubElements.AddNew(TXmlTag.Create)) do begin 314 Name := 'td'; 315 SubElements.Add(THtmlCell(THtmlRow(Rows[Row]).Cells[Column]).Value); 316 end; 317 end; 318 end; 319 end; 320 321 constructor THtmlTable.Create; 322 begin 323 Rows := TListObject.Create; 324 end; 325 326 destructor THtmlTable.Destroy; 327 begin 328 Rows.Free; 329 inherited Destroy; 249 330 end; 250 331
Note:
See TracChangeset
for help on using the changeset viewer.