When you position some text over an image shape, you may want to make the image lighter or transparent so it doesn’t interfere with text. This article will demonstrate how to apply transparency to the image inside of a shape using Spire.Presentation with C# and VB.NET.

Step 1: Create a Presentation instance.

Presentation presentation = new Presentation();

Step 2: Create an Image from the specified file.

string imagePath = "logo.png";
Image image = Image.FromFile(imagePath);

Step 3: Add a shape to the first slide.

float width = image.Width;
float height = image.Height;
RectangleF rect = new RectangleF(50, 50, width, height);
IAutoShape shape = presentation.Slides[0].Shapes.AppendShape(ShapeType.Rectangle, rect);
shape.Line.FillType = FillFormatType.None;

Step 4: Fill the shape with image.

shape.Fill.FillType = FillFormatType.Picture;
shape.Fill.PictureFill.Picture.Url = imagePath;
shape.Fill.PictureFill.FillType = PictureFillType.Stretch;

Step 5: Set transparency on the image.

shape.Fill.PictureFill.Picture.Transparency = 50;

Step 6: Save to file.

presentation.SaveToFile("output.pptx", FileFormat.Pptx2013);

Output:

Apply Transparency to Image in PowerPoint in C#, VB.NET

Full Code:

[C#]
using Spire.Presentation;
using Spire.Presentation.Drawing;
using System.Drawing;

namespace ApplyTransparency
{

    class Program
    {

        static void Main(string[] args)
        {
            {
                //create a PowerPoint document
                Presentation presentation = new Presentation();
                string imagePath = "logo.png";
                Image image = Image.FromFile(imagePath);
                float width = image.Width;
                float height = image.Height;
                RectangleF rect = new RectangleF(50, 50, width, height);
                //add a shape
                IAutoShape shape = presentation.Slides[0].Shapes.AppendShape(ShapeType.Rectangle, rect);
                shape.Line.FillType = FillFormatType.None;
                //fill shape with image
                shape.Fill.FillType = FillFormatType.Picture;
                shape.Fill.PictureFill.Picture.Url = imagePath;
                shape.Fill.PictureFill.FillType = PictureFillType.Stretch;
                //set transparency on image
                shape.Fill.PictureFill.Picture.Transparency = 50;
                //save file
                presentation.SaveToFile("output.pptx", FileFormat.Pptx2013);
            }
        }

    }
}
[VB.NET]
Imports Spire.Presentation
Imports Spire.Presentation.Drawing
Imports System.Drawing

Namespace ApplyTransparency

	Class Program

		Private Shared Sub Main(args As String())
			If True Then
				'create a PowerPoint document
				Dim presentation As New Presentation()
				Dim imagePath As String = "logo.png"
				Dim image__1 As Image = Image.FromFile(imagePath)
				Dim width As Single = image__1.Width
				Dim height As Single = image__1.Height
				Dim rect As New RectangleF(50, 50, width, height)
				'add a shape
				Dim shape As IAutoShape = presentation.Slides(0).Shapes.AppendShape(ShapeType.Rectangle, rect)
				shape.Line.FillType = FillFormatType.None
				'fill shape with image
				shape.Fill.FillType = FillFormatType.Picture
				shape.Fill.PictureFill.Picture.Url = imagePath
				shape.Fill.PictureFill.FillType = PictureFillType.Stretch
				'set transparency on image
				shape.Fill.PictureFill.Picture.Transparency = 50
				'save file
				presentation.SaveToFile("output.pptx", FileFormat.Pptx2013)
			End If
		End Sub

	End Class
End Namespace

Using Excel conditional formatting, we can quickly find and highlight the duplicate and unique values in a selected cell range. In this article, we’re going to show you how to programmatically highlight duplicate and unique values with different colors using Spire.XLS and conditional formatting.

Detail steps:

Step 1: Initialize an object of Workbook class 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: Use conditional formatting to highlight duplicate values in range "A2:A10" with IndianRed color.

XlsConditionalFormats xcfs1 = sheet.ConditionalFormats.Add();
xcfs1.AddRange(sheet.Range["A2:A10"]);

IConditionalFormat format1 = xcfs1.AddCondition();
format1.FormatType = ConditionalFormatType.DuplicateValues;
format1.BackColor = Color.IndianRed;

Step 4: Use conditional formatting to highlight unique values in range "A2:A10" with Yellow color.

IConditionalFormat format2 = xcfs1.AddCondition();
format2.FormatType = ConditionalFormatType.UniqueValues;
format2.BackColor = Color.Yellow;"

Step 5: Save the file.

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

Screenshot:

Highlight Duplicate and Unique Values in Excel Using C#

Full code:

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

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

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

            //Use conditional formatting to highlight duplicate values in range "A2:A10" with IndianRed color
            XlsConditionalFormats xcfs1 = sheet.ConditionalFormats.Add();
            xcfs1.AddRange(sheet.Range["A2:A10"]);

            IConditionalFormat format1 = xcfs1.AddCondition();
            format1.FormatType = ConditionalFormatType.DuplicateValues;
            format1.BackColor = Color.IndianRed;

            //Use conditional formatting to highlight unique values in range "A2:A10" with Yellow color
            IConditionalFormat format2 = xcfs1.AddCondition();
            format2.FormatType = ConditionalFormatType.UniqueValues;
            format2.BackColor = Color.Yellow;

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

        }
    }
}

We have already demonstrated how to insert footnote to the word document with the help of Spire.Doc. This article we will show you how to set the position and number format for the footnote. The footnote position can be at the bottom of each page or below text. The default number format for the footnote is “1, 2, 3”. The following example shows how to set the position, number format, and the restart rule of footnote by calling the property of Section.FootnoteOptions.

Firstly, view the Footnote options under Microsoft Word and the original sample document file:

How to set the position and number format for word footnote in C#

How to set the position and number format for word footnote in C#

How to set the position and number format for word footnote 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.Docx2013);

Step 2: Get the first section from the document.

Section sec = doc.Sections[0];

Step 3: Set the number format, restart rule and position for the footnote.

sec.FootnoteOptions.NumberFormat = FootnoteNumberFormat.UpperCaseLetter;
sec.FootnoteOptions.RestartRule = FootnoteRestartRule.RestartPage;
sec.FootnoteOptions.Position = FootnotePosition.PrintAtBottomOfPage;

Step 4: Save the document to file.

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

Effective screenshot after setting the formatting for the footnote.

How to set the position and number format for word footnote in C#

How to set the position and number format for word footnote in C#

Full codes of how to set the footnote options:

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

Section sec = doc.Sections[0];

sec.FootnoteOptions.NumberFormat = FootnoteNumberFormat.UpperCaseLetter;
sec.FootnoteOptions.RestartRule = FootnoteRestartRule.RestartPage;
sec.FootnoteOptions.Position = FootnotePosition.PrintAtBottomOfPage;

////Clear all the formatting for the footnote and back to the default opitions
//sec.FootnoteOptions.ClearFormatting();

doc.SaveToFile("Footnoteoptions.docx", FileFormat.Docx2013);
page 181