Supported selectors:
- Universal selector (“*”), selects all elements in document, represented as *.
- Type selector (“_typename_”), selects all elements of the given type. E.g. “textbox”. It's possible to list several types using comma, e.g. "textbox, section, image".
- Class selector (“.classname”), selects all elements that belong to specific class. E.g. “*.myclass” selects all elements with class “myclass”. Because element can have multiple classes set, it is possible to specify several classes in selector, for example “*.myclass1.myclass2”.
- Id selector(“#elementID”). An element can have an id set, and this selector matches the element with specific id. Sample: “texbox#help”, selects the textbox element with ID “help”
-
Child selector (“[ancestor]>child”), selects all elements that are immediate children of ancestor element, square brackets indicate optionality of the ancestor, in case of absence it will behave like as “*” would be set.
Samples:
“> textbox” – same as “textbox”, selects all textboxes that are children of any element.
“section > textbox ” – select all textboxes which are placed in sections
“flowdocument > section> textbox.subheader” – selects all textboxes with class ”subheader” set, nested under any section that is a child of root element.
-
Descendant selector(“element_1 element_2”), selects all elements which are descendants of the given element.
Sample:
“section#header image” – selects all images in section with ID=”header” regardless of the nesting.
-
Adjacent element selector (“predessor + element”), selects the element that precedes some element.
Sample:
“image + textbox” – selects all images that precede a textbox.
How the styles are being resolved:
- Directly assigned value is requested first. It's the value you set using arbitraty property of the content element.
- If no value is set using p.1, we are trying to find its value using selectors and styles registered. a) look for all selectors that match given element b) select value according to matching rules (these rules are: specificity of the selector and order of addition, if specificity is the same, we use order)
- Request parent's value if property is inheritable and use the same scheme
Namespace: Apitron.PDF.Kit.Styles
Assembly: Apitron.PDF.Kit (in Apitron.PDF.Kit.dll) Version: 2.0.37.0 (2.0.37.0)
Parameters
- selector
- Type: SystemString
The selector. - style
- Type: Apitron.PDF.Kit.StylesStyle
The style.
Exception | Condition |
---|---|
ArgumentNullException | if one of the arguments is null. |
SelectorParseException | if selector has invalid format. |