TLama

Untitled

Oct 21st, 2013
269
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 1.04 KB | None | 0 0
  1. procedure HandleStyleSheets(const Document: IDispatch);
  2. var
  3.   Doc: IHTMLDocument2;                      // document object
  4.   StyleSheets: IHTMLStyleSheetsCollection;  // document's style sheets
  5.   SheetIdx: Integer;                        // loops thru style sheets
  6.   StyleSheet: IHTMLStyleSheet;              // reference to a style sheet
  7.   RuleIdx: Integer;                         // loops thru style sheet rules
  8.   Style: IHTMLRuleStyle;                    // ref to rule's style
  9. begin
  10.   if not Supports(Document, IHTMLDocument2, Doc) then
  11.     Exit;
  12.   StyleSheets := Doc.styleSheets;
  13.   for SheetIdx := 0 to Pred(StyleSheets.length) do
  14.   begin
  15.     if Supports(StyleSheets.item(SheetIdx), IHTMLStyleSheet, StyleSheet) then
  16.     begin
  17.       for RuleIdx := 0 to Pred(StyleSheet.rules.length) do
  18.       begin
  19.         Style := StyleSheet.rules.item(RuleIdx).style;
  20.         Style.backgroundImage := '';  // removes any background image
  21.         Style.backgroundColor := '';  // resets background colour to default
  22.       end;
  23.     end;
  24.   end;
  25. end;
Advertisement
Add Comment
Please, Sign In to add comment