Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- procedure HandleStyleSheets(const Document: IDispatch);
- var
- Doc: IHTMLDocument2; // document object
- StyleSheets: IHTMLStyleSheetsCollection; // document's style sheets
- SheetIdx: Integer; // loops thru style sheets
- StyleSheet: IHTMLStyleSheet; // reference to a style sheet
- RuleIdx: Integer; // loops thru style sheet rules
- Style: IHTMLRuleStyle; // ref to rule's style
- begin
- if not Supports(Document, IHTMLDocument2, Doc) then
- Exit;
- StyleSheets := Doc.styleSheets;
- for SheetIdx := 0 to Pred(StyleSheets.length) do
- begin
- if Supports(StyleSheets.item(SheetIdx), IHTMLStyleSheet, StyleSheet) then
- begin
- for RuleIdx := 0 to Pred(StyleSheet.rules.length) do
- begin
- Style := StyleSheet.rules.item(RuleIdx).style;
- Style.backgroundImage := ''; // removes any background image
- Style.backgroundColor := ''; // resets background colour to default
- end;
- end;
- end;
- end;
Advertisement
Add Comment
Please, Sign In to add comment