Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions samples/spreadsheet/copy_worksheet_with_sax/cs/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,13 @@ void CopySheetSAX(string path)
if (reader.IsStartElement)
{
writer.WriteStartElement(reader);

string text = reader.GetText();

if (text.Length > 0)
{
writer.WriteString(text);
}
}
else if (reader.IsEndElement)
{
Expand Down
2 changes: 2 additions & 0 deletions samples/spreadsheet/copy_worksheet_with_sax/vb/Program.vb
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ Module Program
Else
If reader.IsStartElement Then
writer.WriteStartElement(reader)
Dim text As String = reader.GetText()
If text.Length > 0 Then writer.WriteString(text)
ElseIf reader.IsEndElement Then
writer.WriteEndElement()
End If
Expand Down
8 changes: 7 additions & 1 deletion samples/word/replace_text_with_sax/cs/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ void ReplaceTextWithSAX(string path, string textToReplace, string replacementTex
string text = reader.GetText().Replace(textToReplace, replacementText);

writer.WriteString(text);

}
else
{
Expand All @@ -60,6 +59,13 @@ void ReplaceTextWithSAX(string path, string textToReplace, string replacementTex
if (reader.IsStartElement)
{
writer.WriteStartElement(reader);

string text = reader.GetText();

if (text.Length > 0)
{
writer.WriteString(text);
}
}
else if (reader.IsEndElement)
{
Expand Down
2 changes: 2 additions & 0 deletions samples/word/replace_text_with_sax/vb/Program.vb
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ Module Program
' Write the other XML elements without editing
If reader.IsStartElement Then
writer.WriteStartElement(reader)
Dim text As String = reader.GetText()
If text.Length > 0 Then writer.WriteString(text)
ElseIf reader.IsEndElement Then
writer.WriteEndElement()
End If
Expand Down
Loading