Formulas are commonly used in Excel to calculate data, at some point, we may want to remove these formulas from Excel but keep their calculated values. This article is going to demonstrate how to remove formulas from cells but keep the values using Spire.XLS.

The sample file we used for demonstration:

Remove Formulas from Cells but Keep Values in Excel in C#

Detail steps:

Step 1: Instantiate a Workbook object and load the excel file.

Workbook workbook = new Workbook();
workbook.LoadFromFile("Input.xlsx");

Step 2: Remove formulas from cells and keep the calculated values.

//Loop through worksheets
foreach (Worksheet sheet in workbook.Worksheets)
{
    //Loop through cells
    foreach (CellRange cell in sheet.Range)
    {
        //If the cell contain formula, get the formula value, clear cell content, and then fill the formula value into the cell 
        if (cell.HasFormula)
        {
             Object value = cell.FormulaValue;                        
             cell.Clear(ExcelClearOptions.ClearContent);
             cell.Value2 = value;
        }
    }
}

Step 3: Save the file.

workbook.SaveToFile("DeleteFormula.xlsx", ExcelVersion.Version2013);

Screenshot:

Remove Formulas from Cells but Keep Values in Excel in C#

Full code:

//Instantiate a Workbook object
Workbook workbook = new Workbook();
//Load the excel file
workbook.LoadFromFile("Input.xlsx");

//Loop through worksheets
foreach (Worksheet sheet in workbook.Worksheets)
{
    //Loop through cells
    foreach (CellRange cell in sheet.Range)
    {
        //If the cell contain formula, get the formula value, clear cell content, and then fill the formula value into the cell 
        if (cell.HasFormula)
        {
             Object value = cell.FormulaValue;                        
             cell.Clear(ExcelClearOptions.ClearContent);
             cell.Value2 = value;
        }
    }
}           

//Save the file
workbook.SaveToFile("DeleteFormula.xlsx", ExcelVersion.Version2013);

When you want to use multiple themes in one presentation, you’ll need multiple slide masters. In this article, you will learn how create additional slide masters and apply them to different slides, by using Spire.Presentation with C# and VB.NET.

Step 1: Create a PowerPoint document and insert four slides to it. There are five slides in total including the default slide.

Presentation ppt = new Presentation();
for (int i = 0; i < 4; i++)
{
    ppt.Slides.Append();
}

Step 2: Get the first default slide master.

IMasterSlide first_master = ppt.Masters[0];

Step 3: Append another slide master.

ppt.Masters.AppendSlide(first_master);
IMasterSlide second_master = ppt.Masters[1];

Step 4: Set different background image for the two slide masters.

string pic1 = @"C:\Users\Administrator\Desktop\image-1.png";
string pic2 = @"C:\Users\Administrator\Desktop\image-2.png";
RectangleF rect = new RectangleF(0, 0, ppt.SlideSize.Size.Width, ppt.SlideSize.Size.Height);
first_master.SlideBackground.Fill.FillType = FillFormatType.Picture;         
IEmbedImage image1 = first_master.Shapes.AppendEmbedImage(ShapeType.Rectangle, pic1, rect);
first_master.SlideBackground.Fill.PictureFill.Picture.EmbedImage = image1 as IImageData;
second_master.SlideBackground.Fill.FillType = FillFormatType.Picture;
IEmbedImage image2 = second_master.Shapes.AppendEmbedImage(ShapeType.Rectangle, pic2, rect);
second_master.SlideBackground.Fill.PictureFill.Picture.EmbedImage = image2 as IImageData;

Step 5: Apply the first master with layout to the first slide.

ppt.Slides[0].Layout = first_master.Layouts[1];

Step 6: Apply the second master with layout to other slides.

for (int i = 1; i < ppt.Slides.Count; i++)
{
    ppt.Slides[i].Layout = second_master.Layouts[8];
}

Step 7: Save the file.

ppt.SaveToFile("result.pptx", FileFormat.Pptx2013);

Output:

Create Multiple Slide Maters and Apply Them to Individual Slides in C#, VB.NET

Full Code:

[C#]
Presentation ppt = new Presentation();
ppt.SlideSize.Type = SlideSizeType.Screen16x9;
for (int i = 0; i < 4; i++)
{
    ppt.Slides.Append();
}

IMasterSlide first_master = ppt.Masters[0];
ppt.Masters.AppendSlide(first_master);
IMasterSlide second_master = ppt.Masters[1];

string pic1 = @"C:\Users\Administrator\Desktop\image-1.png";
string pic2 = @"C:\Users\Administrator\Desktop\image-2.png";
RectangleF rect = new RectangleF(0, 0, ppt.SlideSize.Size.Width, ppt.SlideSize.Size.Height);
first_master.SlideBackground.Fill.FillType = FillFormatType.Picture;         
IEmbedImage image1 = first_master.Shapes.AppendEmbedImage(ShapeType.Rectangle, pic1, rect);
first_master.SlideBackground.Fill.PictureFill.Picture.EmbedImage = image1 as IImageData;
second_master.SlideBackground.Fill.FillType = FillFormatType.Picture;
IEmbedImage image2 = second_master.Shapes.AppendEmbedImage(ShapeType.Rectangle, pic2, rect);
second_master.SlideBackground.Fill.PictureFill.Picture.EmbedImage = image2 as IImageData;

ppt.Slides[0].Layout = first_master.Layouts[1];
for (int i = 1; i < ppt.Slides.Count; i++)
{
    ppt.Slides[i].Layout = second_master.Layouts[8];
}
ppt.SaveToFile("result.pptx", FileFormat.Pptx2013);
[VB.NET]
Dim ppt As Presentation = New Presentation()
ppt.SlideSize.Type = SlideSizeType.Screen16x9
For i As Integer = 0 To 4 - 1
    ppt.Slides.Append()
Next

Dim first_master As IMasterSlide = ppt.Masters(0)
ppt.Masters.AppendSlide(first_master)
Dim second_master As IMasterSlide = ppt.Masters(1)

Dim pic1 As String =  "C:\Users\Administrator\Desktop\image-1.png" 
Dim pic2 As String =  "C:\Users\Administrator\Desktop\image-2.png" 
Dim rect As RectangleF =  New RectangleF(0,0,ppt.SlideSize.Size.Width,ppt.SlideSize.Size.Height) 
first_master.SlideBackground.Fill.FillType = FillFormatType.Picture         
Dim image1 As IEmbedImage =  first_master.Shapes.AppendEmbedImage(ShapeType.Rectangle,pic1,rect) 
first_master.SlideBackground.Fill.PictureFill.Picture.EmbedImage = image1 as IImageData
second_master.SlideBackground.Fill.FillType = FillFormatType.Picture
Dim image2 As IEmbedImage =  second_master.Shapes.AppendEmbedImage(ShapeType.Rectangle,pic2,rect) 
second_master.SlideBackground.Fill.PictureFill.Picture.EmbedImage = image2 as IImageData
ppt.Slides(0).Layout = first_master.Layouts(1)
For i As Integer = 1 To ppt.Slides.Count - 1
    ppt.Slides(i).Layout = second_master.Layouts(8)
Next

ppt.SaveToFile("result.pptx", FileFormat.Pptx2013)

Bookmarks are a great way to specify important locations on a Word document. Spire.Doc supports to access the bookmarks within the document and insert objects such as text, image and table at the bookmark location. This article will show you how to access a specific bookmark and replace the current bookmark content with a table.

Step 1: Load a template Word document.

Document doc = new Document();
doc.LoadFromFile(@"C:\Users\Administrator\Desktop\employee.docx");

Step 2: Create a Table object.

Table table = new Table(doc,true);

Step 3: Fill the table with sample data.

DataTable dt = new DataTable();
dt.Columns.Add("id", typeof(string));
dt.Columns.Add("name", typeof(string));
dt.Columns.Add("job", typeof(string));
dt.Columns.Add("email", typeof(string));
dt.Columns.Add("salary", typeof(string));
dt.Rows.Add(new string[] { "Emp_ID", "Name", "Job", "E-mail", "Salary" });
dt.Rows.Add(new string[] { "0241","Andrews", "Engineer", "andrews@outlook.com" ,"3.8K"});
dt.Rows.Add(new string[] { "0242","White", "Manager", "white@outlook.com","4.2K" });
dt.Rows.Add(new string[] { "0243","Martin", "Secretary", "martin@gmail.com", "3.5K" });
table.ResetCells(dt.Rows.Count, dt.Columns.Count);          
for (int i = 0; i < dt.Rows.Count; i++)
{
    for (int j = 0; j < dt.Columns.Count; j++)
    {
        table.Rows[i].Cells[j].AddParagraph().AppendText(dt.Rows[i][j].ToString());
    }
}

Step 4: Get the specific bookmark by its name.

BookmarksNavigator navigator = new BookmarksNavigator(doc);
navigator.MoveToBookmark("bookmark_employee");

Step 5: Create a TextBodyPart instance and add the table to it.

TextBodyPart part = new TextBodyPart(doc);
part.BodyItems.Add(table);

Step 6: Replace the current bookmark content with the TextBodyPart object.

navigator.ReplaceBookmarkContent(part);

Step 7: Save the file.

doc.SaveToFile("output.docx", FileFormat.Docx2013);

Result:

Replace Bookmark with a Table in Word Documents in C#, VB.NET

Full Code:

[C#]
Document doc = new Document();
doc.LoadFromFile(@"C:\Users\Administrator\Desktop\employee.docx");

Table table = new Table(doc,true);        
DataTable dt = new DataTable();
dt.Columns.Add("id", typeof(string));
dt.Columns.Add("name", typeof(string));
dt.Columns.Add("job", typeof(string));
dt.Columns.Add("email", typeof(string));
dt.Columns.Add("salary", typeof(string));
dt.Rows.Add(new string[] { "Emp_ID", "Name", "Job", "E-mail", "Salary" });
dt.Rows.Add(new string[] { "0241", "Andrews", "Engineer", "andrews@outlook.com", "3.8K" });
dt.Rows.Add(new string[] { "0242", "White", "Manager", "white@outlook.com", "4.2K" });
dt.Rows.Add(new string[] { "0243", "Martin", "Secretary", "martin@gmail.com", "3.5K" });
table.ResetCells(dt.Rows.Count, dt.Columns.Count);
for (int i = 0; i < dt.Rows.Count; i++)
{
    for (int j = 0; j < dt.Columns.Count; j++)
    {
        table.Rows[i].Cells[j].AddParagraph().AppendText(dt.Rows[i][j].ToString());
    }
}

BookmarksNavigator navigator = new BookmarksNavigator(doc);
navigator.MoveToBookmark("bookmark_employee");
TextBodyPart part = new TextBodyPart(doc);
part.BodyItems.Add(table);
navigator.ReplaceBookmarkContent(part);
doc.SaveToFile("output.docx", FileFormat.Docx2013);
System.Diagnostics.Process.Start("output.docx"); 
[VB.NET]
Dim doc As Document = New Document()
doc.LoadFromFile("C:\Users\Administrator\Desktop\employee.docx")
Dim table As Table = New Table(doc, True)
Dim dt As DataTable = New DataTable()
dt.Columns.Add("id", GetType(String))
dt.Columns.Add("name", GetType(String))
dt.Columns.Add("job", GetType(String))
dt.Columns.Add("email", GetType(String))
dt.Columns.Add("salary", GetType(String))
dt.Rows.Add(New String() {"Emp_ID", "Name", "Job", "E-mail", "Salary"})
dt.Rows.Add(New String() {"0241", "Andrews", "Engineer", "andrews@outlook.com", "3.8K"})
dt.Rows.Add(New String() {"0242", "White", "Manager", "white@outlook.com", "4.2K"})
dt.Rows.Add(New String() {"0243", "Martin", "Secretary", "martin@gmail.com", "3.5K"})
table.ResetCells(dt.Rows.Count, dt.Columns.Count)
For i As Integer = 0 To dt.Rows.Count - 1
    For j As Integer = 0 To dt.Columns.Count - 1
        table.Rows(i).Cells(j).AddParagraph().AppendText(dt.Rows(i)(j).ToString())
    Next
Next

Dim navigator As BookmarksNavigator = New BookmarksNavigator(doc)
navigator.MoveToBookmark("bookmark_employee")
Dim part As TextBodyPart = New TextBodyPart(doc)
part.BodyItems.Add(table)
navigator.ReplaceBookmarkContent(part)
doc.SaveToFile("output.docx", FileFormat.Docx2013)

This article demonstrates the steps to highlight below and above average values with conditional formatting in Excel using Spire.XLS.

Below screenshot shows the sample file we used for demonstration:

Highlight Below and Above Average Values in Excel in C#

Detail steps:

Step 1: Instantiate a Workbook object and load the Excel file.

Workbook workbook = new Workbook();
workbook.LoadFromFile("Input.xlsx");

Step 2: Get the first worksheet.

Worksheet sheet = workbook.Worksheets[0];

Step 3: Highlight cells below average values with SkyBlue color.

//Add conditional format
XlsConditionalFormats format1 = sheet.ConditionalFormats.Add();
//Set the cell range to apply the formatting
format1.AddRange(sheet.Range["B2:B8"]);
//Add below average condition
IConditionalFormat cf1 = format1.AddAverageCondition(AverageType.Below);
//Highlight cells below average values
cf1.BackColor = Color.SkyBlue;

Step 4: Highlight cells above average values with Orange color.

//Add conditional format
XlsConditionalFormats format2 = sheet.ConditionalFormats.Add();
//Set the cell range to apply the formatting
format2.AddRange(sheet.Range["B2:B8"]);
//Add above average condition
IConditionalFormat cf2 = format1.AddAverageCondition(AverageType.Above);
//Highlight cells above average values
cf2.BackColor = Color.Orange;

Step 5: Save the file.

workbook.SaveToFile("AverageCondition.xlsx", ExcelVersion.Version2013);

Screenshot:

Highlight Below and Above Average Values in Excel in C#

Full code:

using System.Drawing;
using Spire.Xls;
using Spire.Xls.Core;
using Spire.Xls.Core.Spreadsheet.Collections;

namespace Average_Condition
{
    class Program
    {
        static void Main(string[] args)
        {
            //Instantiate a Workbook object
            Workbook workbook = new Workbook();
            //Load Excel file
            workbook.LoadFromFile("Input.xlsx");

            //Get the first worksheet
            Worksheet sheet = workbook.Worksheets[0];

            //Add conditional format
            XlsConditionalFormats format1 = sheet.ConditionalFormats.Add();
            //Set the cell range to apply the formatting
            format1.AddRange(sheet.Range["B2:B8"]);
            //Add below average condition
            IConditionalFormat cf1 = format1.AddAverageCondition(AverageType.Below);
            //Highlight cells below average values
            cf1.BackColor = Color.SkyBlue;

            //Add conditional format
            XlsConditionalFormats format2 = sheet.ConditionalFormats.Add();
            //Set the cell range to apply the formatting
            format2.AddRange(sheet.Range["B2:B8"]);
            //Add above average condition
            IConditionalFormat cf2 = format1.AddAverageCondition(AverageType.Above);
            //Highlight cells above average values
            cf2.BackColor = Color.Orange;
            
            //Save the file
            workbook.SaveToFile("AverageCondition.xlsx", ExcelVersion.Version2013);
        }
    }
}

Spire.XLS supports to insert hyperlinks in Excel, and modify or remove hyperlinks in an existing Excel document. This article presents how to retrieve hyperlink information from an Excel worksheet in C# and VB.NET.

Step 1: Create a Workbook object and load a sample Excel file.

Workbook wb = new Workbook();
wb.LoadFromFile(@"C:\Users\Administrator\Desktop\Hyperlinks.xlsx");

Step 2: Get the first worksheet.

Worksheet sheet = wb.Worksheets[0];

Step 3: Get the hyperlink information from the worksheet.

foreach (var item in sheet.HyperLinks)
{
    string address = item.Address;
    CellRange range = item.Range;       
    Console.WriteLine(string.Format("Cell[{0},{1}] contains URL: {2}", range.Row, range.Column, address));
}

Output:

Retrieve Hyperlinks from an Excel Sheet in C#, VB.NET

Full Code:

[C#]
Workbook wb = new Workbook();
wb.LoadFromFile(@"C:\Users\Administrator\Desktop\Hyperlinks.xlsx");

Worksheet sheet = wb.Worksheets[0];
foreach (var item in sheet.HyperLinks)
{
    string address = item.Address;
    CellRange range = item.Range;
    Console.WriteLine(string.Format("Cell[{0},{1}] contains URL: {2}", range.Row, range.Column, address));
}
[VB.NET]
Dim wb As Workbook =  New Workbook() 
wb.LoadFromFile("C:\Users\Administrator\Desktop\Hyperlinks.xlsx")
 
Dim sheet As Worksheet =  wb.Worksheets(0) 
Dim item As var
For Each item In sheet.HyperLinks
    Dim address As String =  item.Address 
    Dim range As CellRange =  item.Range 
    Console.WriteLine(String.Format("Cell[{0},{1}] contains URL: {2}", range.Row, range.Column, address))
Next

Spire.Presentation supports to set the default position (e.g. Outside End, Center, Inside End, Inside base etc.) of data labels through ChartDataLabel.Position property, it also supports to set custom position of data labels using "ChartDataLabel.X" and "ChartDataLabel.Y" properties. This article is going to elaborate how we can set default and custom position of data labels using Spire.Presentation.

Detail steps:

Step 1: Initialize a Presentation object and load the PowerPoint file.

Presentation ppt = new Presentation();
ppt.LoadFromFile(@"Input.pptx");

Step 2: Get the chart.

IChart chart = ppt.Slides[0].Shapes[0] as IChart;

Step 3: Add data label to the chart and set its id.

ChartDataLabel label1 = chart.Series[0].DataLabels.Add();            
label1.ID = 0;  

Step 4: Set the position of data label.

//Set the default position of data label. This position is relative to the data markers.
//label1.Position = ChartDataLabelPosition.OutsideEnd;

//Set custom position of data label. This position is relative to the default position. 
label1.X = 0.1f;
label1.Y = -0.1f;

Step 5: Set the properties of data label.

//Set label value visible
label1.LabelValueVisible = true;
//Set legend key invisible
label1.LegendKeyVisible = false;
//Set category name invisible
label1.CategoryNameVisible = false;
//Set series name invisible
label1.SeriesNameVisible = false;
//Set Percentage invisible
label1.PercentageVisible = false;

//Set border style and fill style of data label
label1.Line.FillType = Spire.Presentation.Drawing.FillFormatType.Solid;
label1.Line.SolidFillColor.Color = Color.Blue;
label1.Fill.FillType = Spire.Presentation.Drawing.FillFormatType.Solid;
label1.Fill.SolidColor.Color = Color.Orange;

Step 6: Save the file.

ppt.SaveToFile(@"Output.pptx", FileFormat.Pptx2013);

Screenshot:

Default position (Outside End):

Set Position of Chart Data Labels in PowerPoint in C#

Custom position:

Set Position of Chart Data Labels in PowerPoint in C#

Full code:

using Spire.Presentation;
using Spire.Presentation.Charts;
using System.Drawing;

namespace Set_Position_of_Chart_Data_Label_in_PPT
{
    class Program
    {
        static void Main(string[] args)
        {
            //Initialize a Presentation object
            Presentation ppt = new Presentation();
            //Load the PowerPoint file
            ppt.LoadFromFile(@"Input.pptx");

            //Get the chart
            IChart chart = ppt.Slides[0].Shapes[0] as IChart;

            //Add data label to chart and set its id
            ChartDataLabel label1 = chart.Series[0].DataLabels.Add();            
            label1.ID = 0;

            //Set the default position of data label. This position is relative to the data markers.
            //label1.Position = ChartDataLabelPosition.OutsideEnd;

            //Set custom position of data label. This position is relative to the default position.
            label1.X = 0.1f;
            label1.Y = -0.1f;

            //Set label value visible
            label1.LabelValueVisible = true;
            //Set legend key invisible
            label1.LegendKeyVisible = false;
            //Set category name invisible
            label1.CategoryNameVisible = false;
            //Set series name invisible
            label1.SeriesNameVisible = false;
            //Set Percentage invisible
            label1.PercentageVisible = false;

            //Set border style and fill style of data label
            label1.Line.FillType = Spire.Presentation.Drawing.FillFormatType.Solid;
            label1.Line.SolidFillColor.Color = Color.Blue;
            label1.Fill.FillType = Spire.Presentation.Drawing.FillFormatType.Solid;
            label1.Fill.SolidColor.Color = Color.Orange;

            //Save the file                                   
            ppt.SaveToFile(@"Output.pptx", FileFormat.Pptx2013);
        }
    }
}

We have already demonstrated how to use Spire.Presentation to insert HTML formatted text to PowerPoint slide. Now from Spire.Presentation 3.4.1, it supports to insert html (including text, image, audio and video) into presentation slides and each html tag will be added to the slide as a separate shape. The following code snippets demonstrate how to.

Step 1: Create an instance of Presentation class.

Presentation ppt = new Presentation();

Step 2: Get the shapes on the first slide.

ShapeList shapes = ppt.Slides[0].Shapes;

Step 3: Add contents to shape from HTML code, which includes text and image.

shapes.AddFromHtml("<html><div><p>First paragraph</p><p><img src='https://cdn.e-iceblue.com/Logo.jpg'/></p><p>Second paragraph </p></html>");

Step 4: Save the document to file.

ppt.SaveToFile("Result.pptx", FileFormat.Pptx2010);

Effective screenshot:

Insert HTML with image into the Presentation slides in C#

Full codes of how to insert HTML into the Presentation slides:

Presentation ppt = new Presentation();

ShapeList shapes = ppt.Slides[0].Shapes;
            
shapes.AddFromHtml("<html><div><p>First paragraph</p><p><img src='https://cdn.e-iceblue.com/Logo.jpg'/></p><p>Second paragraph </p></html>");

ppt.SaveToFile("Result.pptx", FileFormat.Pptx2010);

Using Spire.XLS, you're able to apply multiple fonts in a single cell in order to create rich-formatted text within the cell, you can also extract the formatted text from the cell(s) in an existing Excel document. The following code snippets will show you how to read rich text from an Excel cell in C# and VB.NET.

Step 1: Create a Workbook instance and load a sample Excel file.

Workbook wb = new Workbook();
wb.LoadFromFile(@"C:\Users\Administrator\Desktop\Sample.xlsx");

Step 2: Get the first worksheet.

Worksheet sheet= wb.Worksheets[0];

Step 3: Get the rtf text from the specified cell.

richTextBox1.Rtf = sheet.Range["B2"].RichText.RtfText;

Output:

Read Rich Text from an Excel Cell in C#, VB.NET

Full Code:

[C#]
private void btn_read_Click(object sender, EventArgs e)
{
    Workbook wb = new Workbook();
    wb.LoadFromFile(@"C:\Users\Administrator\Desktop\Sample.xlsx");
    Worksheet sheet= wb.Worksheets[0];
    richTextBox1.Rtf = sheet.Range["B2"].RichText.RtfText;
} 
[VB.NET]
Private  Sub btn_read_Click(ByVal sender As Object, ByVal e As EventArgs)
    Dim wb As Workbook =  New Workbook() 
    wb.LoadFromFile("C:\Users\Administrator\Desktop\Sample.xlsx")
    Dim sheet As Worksheet =  wb.Worksheets(0) 
    richTextBox1.Rtf = sheet.Range("B2").RichText.RtfText
End Sub

Hyperlinks can direct readers to a web page, a file, an E-mail address, or other place in the same PowerPoint file. A hyperlink can be added to a text, an image or a shape. In the previous article, we've illustrated how to add hyperlink to text, this article is going to demonstrate how to add hyperlink to an image in PowerPoint using Spire.Presentation.

Detail steps:

Step 1: Initialize an object of Presentation class and Load the PowerPoint file.

Presentation presentation = new Presentation();
presentation.LoadFromFile("Input.pptx");

Step 2: Get the first slide.

ISlide slide = presentation.Slides[0];

Step 3: Add image to slide.

RectangleF rect = new RectangleF(50, 300, 100, 100);
IEmbedImage image = slide.Shapes.AppendEmbedImage(ShapeType.Rectangle, @"logo.png", rect);

Step 4: Add hyperlink to image.

ClickHyperlink hyperlink = new ClickHyperlink("https://www.e-iceblue.com");
image.Click = hyperlink;

Step 5: Save the file.

presentation.SaveToFile("ImageHyperLink.pptx", FileFormat.Pptx2010);

Screenshot:

Add Hyperlink to an Image in PowerPoint in C#

Full code:

//Initialize an object of Presentation class
Presentation presentation = new Presentation();
//Load the PowerPoint file
presentation.LoadFromFile("test.pptx");

//Get the first slide
ISlide slide = presentation.Slides[0];

//Add image to slide
RectangleF rect = new RectangleF(50, 300, 100, 100);
IEmbedImage image = slide.Shapes.AppendEmbedImage(ShapeType.Rectangle, @"logo.png", rect);

//Add hyperlink to image
ClickHyperlink hyperlink = new ClickHyperlink("https://www.e-iceblue.com");
image.Click = hyperlink;

//Save the file
presentation.SaveToFile("ImageHyperLink.pptx", FileFormat.Pptx2010);

Spire.Doc supports to insert the text and image watermark to the word document in C#. It also supports to remove the text and image watermark from the word document. This article will demonstrate how to remove the watermark from the word document by setting the watermark object as null.

Firstly, view the word document with Text and Image watermark:

Remove the text and image watermark from the word document in C#

Remove the text and image watermark from the word document in C#

Step 1: Create a new instance of Document and load the document from file.

Document doc = new Document();
doc.LoadFromFile("Sample.docx",FileFormat.Docx2010);

Step 2: Set the watermark as null to remove the text and image watermark.

doc.Watermark = null;

Step 3: Save the document to file.

doc.SaveToFile("RemoveWatermark.docx",FileFormat.Docx2010);

Effective screenshot after removing the watermark:

Remove the text and image watermark from the word document in C#

Full codes of removing the watermark from the word document:

Document doc = new Document();
doc.LoadFromFile("Sample.docx",FileFormat.Docx2010);

doc.Watermark = null;

doc.SaveToFile("RemoveWatermark.docx",FileFormat.Docx2010);
Page 3 of 95