forked from egonl/SharpDocx
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
171 additions
and
170 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using DocumentFormat.OpenXml.Wordprocessing; | ||
using SharpDocx.Extensions; | ||
|
||
namespace SharpDocx.CodeBlocks | ||
{ | ||
public class CodeBlock | ||
{ | ||
public string Code { get; } | ||
|
||
public Text Placeholder { get; internal set; } | ||
|
||
internal Text StartText { get; set; } | ||
|
||
internal Text EndText { get; set; } | ||
|
||
public CodeBlock(string code) | ||
{ | ||
Code = code; | ||
} | ||
|
||
internal void RemoveEmptyParagraphs() | ||
{ | ||
var startParagraph = StartText.GetParent<Paragraph>(); | ||
if (startParagraph?.Parent != null && !startParagraph.HasText()) | ||
{ | ||
startParagraph.Remove(); | ||
} | ||
|
||
var endParagraph = EndText.GetParent<Paragraph>(); | ||
if (endParagraph?.Parent != null && !endParagraph.HasText()) | ||
{ | ||
endParagraph.Remove(); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using DocumentFormat.OpenXml.Wordprocessing; | ||
|
||
namespace SharpDocx.CodeBlocks | ||
{ | ||
/// <summary> | ||
/// ConditionalText is used to conditionally show or hide Word elements. | ||
/// </summary> | ||
public class ConditionalText : CodeBlock | ||
{ | ||
public string Condition { get; set; } | ||
|
||
public Text EndConditionalPart { get; set; } | ||
|
||
public ConditionalText(string code) : base(code) | ||
{ | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.