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
// For complete examples and data files, please go to https://github.com/groupdocs-watermark/GroupDocs.Watermark-for-.NET | |
using (Document doc = Document.Load(Utilities.MapSourceFilePath(DocFilePath))) | |
{ | |
TextFormattingSearchCriteria criteria = new TextFormattingSearchCriteria(); | |
criteria.ForegroundColorRange = new ColorRange(); | |
criteria.ForegroundColorRange.MinHue = -5; | |
criteria.ForegroundColorRange.MaxHue = 10; | |
criteria.ForegroundColorRange.MinBrightness = 0.01f; | |
criteria.ForegroundColorRange.MaxBrightness = 0.99f; | |
criteria.BackgroundColorRange = new ColorRange(); |
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
' For complete examples and data files, please go to https://github.com/groupdocs-watermark/GroupDocs.Watermark-for-.NET | |
Using doc As WordsDocument = Document.Load(Of WordsDocument)(Utilities.MapSourceFilePath(FilePath)) | |
For Each section As WordsSection In doc.Sections | |
For i As Object = section.Shapes.Count - 1 To 0 Step -1 | |
For Each fragment As Object In section.Shapes(i).FormattedTextFragments | |
If fragment.ForegroundColor = Color.Red AndAlso fragment.Font.FamilyName = "Arial" Then | |
section.Shapes.RemoveAt(i) | |
Exit For | |
End If | |
Next |
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
// For complete examples and data files, please go to https://github.com/groupdocs-watermark/GroupDocs.Watermark-for-.NET | |
using (WordsDocument doc = Document.Load<WordsDocument>(Utilities.MapSourceFilePath(FilePath))) | |
{ | |
foreach (WordsSection section in doc.Sections) | |
{ | |
for (var i = section.Shapes.Count - 1; i >= 0; i--) | |
{ | |
foreach (var fragment in section.Shapes[i].FormattedTextFragments) | |
{ | |
if (fragment.ForegroundColor == Color.Red && fragment.Font.FamilyName == "Arial") |
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
' For complete examples and data files, please go to https://github.com/groupdocs-watermark/GroupDocs.Watermark-for-.NET | |
Using doc As DiagramDocument = Document.Load(Of DiagramDocument)(Utilities.MapSourceFilePath(FilePath)) | |
For Each page As DiagramPage In doc.Pages | |
For i As Object = page.Shapes.Count - 1 To 0 Step -1 | |
For Each fragment As Object In page.Shapes(i).FormattedTextFragments | |
If fragment.ForegroundColor = Color.Red AndAlso fragment.Font.FamilyName = "Arial" Then | |
page.Shapes.RemoveAt(i) | |
Exit For | |
End If | |
Next |
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
// For complete examples and data files, please go to https://github.com/groupdocs-watermark/GroupDocs.Watermark-for-.NET | |
using (DiagramDocument doc = Document.Load<DiagramDocument>(Utilities.MapSourceFilePath(FilePath))) | |
{ | |
foreach (DiagramPage page in doc.Pages) | |
{ | |
for (var i = page.Shapes.Count - 1; i >= 0; i--) | |
{ | |
foreach (var fragment in page.Shapes[i].FormattedTextFragments) | |
{ | |
if (fragment.ForegroundColor == Color.Red && fragment.Font.FamilyName == "Arial") |
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
' For complete examples and data files, please go to https://github.com/groupdocs-watermark/GroupDocs.Watermark-for-.NET | |
Using doc As SlidesDocument = Document.Load(Of SlidesDocument)(Utilities.MapSourceFilePath(FilePath)) | |
For Each slide As SlidesSlide In doc.Slides | |
For i As Object = slide.Shapes.Count - 1 To 0 Step -1 | |
For Each fragment As Object In slide.Shapes(i).FormattedTextFragments | |
If fragment.ForegroundColor = Color.Red AndAlso fragment.Font.FamilyName = "Arial" Then | |
slide.Shapes.RemoveAt(i) | |
Exit For | |
End If | |
Next |
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
// For complete examples and data files, please go to https://github.com/groupdocs-watermark/GroupDocs.Watermark-for-.NET | |
using (SlidesDocument doc = Document.Load<SlidesDocument>(Utilities.MapSourceFilePath(FilePath))) | |
{ | |
foreach (SlidesSlide slide in doc.Slides) | |
{ | |
for (var i = slide.Shapes.Count - 1; i >= 0; i--) | |
{ | |
foreach (var fragment in slide.Shapes[i].FormattedTextFragments) | |
{ | |
if (fragment.ForegroundColor == Color.Red && fragment.Font.FamilyName == "Arial") |
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
' For complete examples and data files, please go to https://github.com/groupdocs-watermark/GroupDocs.Watermark-for-.NET | |
Using doc As CellsDocument = Document.Load(Of CellsDocument)(Utilities.MapSourceFilePath(FilePath)) | |
For Each section As CellsWorksheet In doc.Worksheets | |
For i As Object = section.Shapes.Count - 1 To 0 Step -1 | |
For Each fragment As Object In section.Shapes(i).FormattedTextFragments | |
If fragment.ForegroundColor = Color.Red AndAlso fragment.Font.FamilyName = "Arial" Then | |
section.Shapes.RemoveAt(i) | |
Exit For | |
End If | |
Next |
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
// For complete examples and data files, please go to https://github.com/groupdocs-watermark/GroupDocs.Watermark-for-.NET | |
using (CellsDocument doc = Document.Load<CellsDocument>(Utilities.MapSourceFilePath(FilePath))) | |
{ | |
foreach (CellsWorksheet section in doc.Worksheets) | |
{ | |
for (var i = section.Shapes.Count - 1; i >= 0; i--) | |
{ | |
foreach (var fragment in section.Shapes[i].FormattedTextFragments) | |
{ | |
if (fragment.ForegroundColor == Color.Red && fragment.Font.FamilyName == "Arial") |
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
' For complete examples and data files, please go to https://github.com/groupdocs-watermark/GroupDocs.Watermark-for-.NET | |
Using doc As WordsDocument = Document.Load(Of WordsDocument)(Utilities.MapSourceFilePath(FilePath)) | |
' Replace hyperlink | |
doc.Sections(0).Shapes(0).Hyperlink = "https://www.groupdocs.com/" | |
' Remove hyperlink | |
doc.Sections(0).Shapes(1).Hyperlink = Nothing | |
doc.Save() |