Skip to content

Commit 4f7fb64

Browse files
ES-999797-Changes added
1 parent 69b09e9 commit 4f7fb64

3 files changed

Lines changed: 103 additions & 3 deletions

File tree

Document-Processing-toc.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4428,6 +4428,12 @@
44284428
</li>
44294429
<li>
44304430
<a href="/document-processing/word/word-library/net/html">HTML Conversions</a>
4431+
<ul>
4432+
<li>
4433+
<a href="/document-processing/word/word-library/net/CSS-Selector">CSS Selector</a>
4434+
</li>
4435+
4436+
</ul>
44314437
</li>
44324438
<li>
44334439
<a href="/document-processing/word/word-library/net/convert-word-document-to-markdown-in-csharp">Word Document to Markdown</a>
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
---
2+
title: CSS Selectors in HTML to Word Conversion | Syncfusion
3+
description: Learn about the CSS selectors supported in HTML content when converting to Word documents using the .NET Word (DocIO) library in Syncfusion.
4+
platform: document-processing
5+
control: DocIO
6+
documentation: UG
7+
---
8+
9+
# CSS Selector
10+
11+
CSS selectors are used to select the HTML elements you want to style and apply a set of CSS rules. There are a few different types of CSS Selectors:
12+
13+
- **Element selector**
14+
- **Class selector**
15+
- **ID selector**
16+
- **Group Selectors**
17+
- **Compound Selectors**
18+
- **Descendant**
19+
20+
<table>
21+
<tr>
22+
<td><strong>Selectors</strong></td>
23+
<td><strong>CSS Code</strong></td>
24+
<td><strong>HTML</strong></td>
25+
</tr>
26+
<tr>
27+
<td>Element Selector</td>
28+
<td>p {
29+
color: yellow;
30+
font-size: 36px;
31+
}
32+
</td>
33+
<td><code>&lt;p&gt;This is Element selector Paragraph&lt;/p&gt;</code></td>
34+
</tr>
35+
<tr>
36+
<td>Class selector</td>
37+
<td>.highlight {
38+
color: red;
39+
font-size: 18pt;
40+
}
41+
</td>
42+
<td><code>&lt;p class="highlight"&gt;This is a class selector Paragraph&lt;/p&gt;</code></td>
43+
</tr>
44+
<tr>
45+
<td>ID selector</td>
46+
<td>#demo-id {
47+
color: #1a73e8;
48+
font-size: 22pt;
49+
font-weight: 600;
50+
}
51+
</td>
52+
<td><code>&lt;p id="demo-id"&gt;This is ID Selector paragraph&lt;/p&gt;</code></td>
53+
</tr>
54+
<tr>
55+
<td>Group Selectors</td>
56+
<td>h2, .group-title {
57+
color: green;
58+
font-size: 20pt;
59+
}
60+
</td>
61+
<td>
62+
<code>&lt;h2&gt;Group Selector Example&lt;/h2&gt;<br>
63+
&lt;p class="group-title"&gt;Paragraph styled by group selector.&lt;/p&gt;</code>
64+
</td>
65+
</tr>
66+
<tr>
67+
<td>Compound Selectors</td>
68+
<td>p.compound {
69+
color: orange;
70+
font-size: 26pt;
71+
font-weight: bold;
72+
}
73+
</td>
74+
<td><code>&lt;p class="compound"&gt;Paragraph for Class + Compound&lt;/p&gt;</code></td>
75+
</tr>
76+
<tr>
77+
<td>Descendant Selectors</td>
78+
<td>div p {
79+
color: #5f7000;
80+
font-style: italic;
81+
font-size: 18px;
82+
}
83+
</td>
84+
<td>
85+
<code>&lt;div&gt;<br>
86+
&nbsp;&nbsp;&lt;p&gt;Descendant Selector: Paragraph inside a div.&lt;/p&gt;<br>
87+
&lt;/div&gt;</code>
88+
</td>
89+
</tr>
90+
</table>
91+
92+
You can download a complete working sample that includes all these CSS selectors from [GitHub] (https://github.com/SyncfusionExamples/DocIO-Examples/tree/main/HTML-conversions/Convert-HTML-with-CSS-Selctor-to-Word)
93+
94+

Document-Processing/Word/Word-Library/NET/faqs/word-document-faqs.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -674,10 +674,10 @@ This is because a Word document is a flow-based document, where contents are not
674674

675675
DocIO is a non-UI component that provides a full-fledged document object model to manipulate the Word document contents based on file-level information. Hence, it is not feasible to retrieve the position of an element within a Word document using DocIO.
676676

677-
#Sensitivity Labels in Word Documents
677+
## Sensitivity Labels in Word Documents
678678

679-
##Does DocIO support sensitivity labels?
679+
## Does DocIO support sensitivity labels?
680680
No, Sensitivity labels are organization-level settings and are not stored within the word document itself. Therefore, DocIO does not support applying or preserving sensitivity labels.
681681

682-
##Can DocIO Open a Document with Sensitivity Labels Applied?
682+
## Can DocIO Open a Document with Sensitivity Labels Applied?
683683
If a document is encrypted due to its sensitivity label configuration, DocIO cannot open it because the content is stored in an encrypted format and requires an authorized Microsoft account for access.

0 commit comments

Comments
 (0)