Skip to content

Instantly share code, notes, and snippets.

// 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)))
{
// Replace hyperlink
doc.Sections[0].Shapes[0].Hyperlink = "https://www.groupdocs.com/";
// Remove hyperlink
doc.Sections[0].Shapes[1].Hyperlink = null;
doc.Save();
' For complete examples and data files, please go to https://github.com/groupdocs-watermark/GroupDocs.Watermark-for-.NET
Using doc As Document = Document.Load(Utilities.MapSourceFilePath(DocFilePath))
Dim watermarks As PossibleWatermarkCollection = doc.FindWatermarks(New TextSearchCriteria(New Regex("someurl\.com")))
For i As Integer = watermarks.Count - 1 To 0 Step -1
' Ensure that only hyperlinks will be removed.
If TypeOf watermarks(i) Is HyperlinkPossibleWatermark Then
' Output the full url of the hyperlink
Console.WriteLine(watermarks(i).Text)
' Remove hyperlink from the document
// 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)))
{
PossibleWatermarkCollection watermarks = doc.FindWatermarks(new TextSearchCriteria(new Regex(@"someurl\.com")));
for (int i = watermarks.Count - 1; i >= 0; i--)
{
// Ensure that only hyperlinks will be removed.
if (watermarks[i] is HyperlinkPossibleWatermark)
{
// Output the full url of the hyperlink
' 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))
Dim shape As DiagramShape = doc.Pages(0).Shapes(0)
For i As Integer = shape.Hyperlinks.Count - 1 To 0 Step -1
If shape.Hyperlinks(i).Address.Contains("http://someurl.com") Then
shape.Hyperlinks.RemoveAt(i)
End If
Next
doc.Save()
// 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)))
{
DiagramShape shape = doc.Pages[0].Shapes[0];
for (int i = shape.Hyperlinks.Count - 1; i >= 0; i--)
{
if (shape.Hyperlinks[i].Address.Contains("http://someurl.com"))
{
shape.Hyperlinks.RemoveAt(i);
}
' 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))
' Replace hyperlink
doc.Slides(0).Charts(0).Hyperlink = "https://www.aspose.com/"
doc.Slides(0).Shapes(0).Hyperlink = "https://www.groupdocs.com/"
' Remove hyperlink
doc.Slides(1).Charts(0).Hyperlink = Nothing
doc.Slides(1).Shapes(0).Hyperlink = Nothing
// 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)))
{
// Replace hyperlink
doc.Slides[0].Charts[0].SetHyperlink(SlidesHyperlinkActionType.MouseClick, "https://www.aspose.com/");
doc.Slides[0].Shapes[0].SetHyperlink(SlidesHyperlinkActionType.MouseClick,"https://www.groupdocs.com/");
// Remove hyperlink
doc.Slides[1].Charts[0].SetHyperlink(SlidesHyperlinkActionType.MouseClick,null);
doc.Slides[1].Shapes[0].SetHyperlink(SlidesHyperlinkActionType.MouseClick,null);
' 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))
' Replace hyperlink
doc.Worksheets(0).Charts(0).Hyperlink = "https://www.aspose.com/"
doc.Worksheets(0).Shapes(0).Hyperlink = "https://www.groupdocs.com/"
' Remove hyperlink
doc.Worksheets(1).Charts(0).Hyperlink = Nothing
doc.Worksheets(1).Shapes(0).Hyperlink = Nothing
// 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)))
{
// Replace hyperlink
doc.Worksheets[0].Charts[0].Hyperlink = "https://www.aspose.com/";
doc.Worksheets[0].Shapes[0].Hyperlink = "https://www.groupdocs.com/";
// Remove hyperlink
doc.Worksheets[1].Charts[0].Hyperlink = null;
doc.Worksheets[1].Shapes[0].Hyperlink = null;
' For complete examples and data files, please go to https://github.com/groupdocs-watermark/GroupDocs.Watermark-for-.NET
Using doc As PdfDocument = Document.Load(Of PdfDocument)(Utilities.MapSourceFilePath(FilePath))
For Each page As PdfPage In doc.Pages
For i As Object = page.Artifacts.Count - 1 To 0 Step -1
For Each fragment As Object In page.Artifacts(i).FormattedTextFragments
If fragment.Font.Size > 42 Then
page.Artifacts.RemoveAt(i)
Exit For
End If
Next