Knowledgebase (2344)
Children categories
Adding shadow effect is one of the good ways to make a data label stand out on your chart. This article is going to show you how to add shadow effect to a chart data label in PowerPoint using Spire.Presentation.
Detail steps:
Step 1: Initialize a Presentation object and load the PowerPoint file.
Presentation ppt = new Presentation(); ppt.LoadFromFile(@"test.pptx");
Step 2: Get the chart.
IChart chart = ppt.Slides[0].Shapes[0] as IChart;
Step 3: Add a data label to the first chart series.
ChartDataLabelCollection dataLabels = chart.Series[0].DataLabels; ChartDataLabel Label = dataLabels.Add(); Label.LabelValueVisible = true;
Step 4: Add outer shadow effect to the data label.
Label.Effect.OuterShadowEffect = new OuterShadowEffect(); //Set shadow color Label.Effect.OuterShadowEffect.ColorFormat.Color = Color.Yellow; //Set blur Label.Effect.OuterShadowEffect.BlurRadius = 5; //Set distance Label.Effect.OuterShadowEffect.Distance = 10; //Set angle Label.Effect.OuterShadowEffect.Direction = 90f;
Step 5: Save the file.
ppt.SaveToFile("Shadow.pptx", FileFormat.Pptx2010);
Screenshot:

Full code:
using System.Drawing;
using Spire.Presentation;
using Spire.Presentation.Charts;
using Spire.Presentation.Collections;
using Spire.Presentation.Drawing;
namespace Add_Shadow_Effect_to_Chart_Datalabel
{
class Program
{
static void Main(string[] args)
{
//Initialize a Presentation object
Presentation ppt = new Presentation();
//Load the PowerPoint file
ppt.LoadFromFile(@"test.pptx");
//Get the chart
IChart chart = ppt.Slides[0].Shapes[0] as IChart;
//Add a data label to the first chart series
ChartDataLabelCollection dataLabels = chart.Series[0].DataLabels;
ChartDataLabel Label = dataLabels.Add();
Label.LabelValueVisible = true;
//Add outer shadow effect to the data label
Label.Effect.OuterShadowEffect = new OuterShadowEffect();
//Set shadow color
Label.Effect.OuterShadowEffect.ColorFormat.Color = Color.Yellow;
//Set blur
Label.Effect.OuterShadowEffect.BlurRadius = 5;
//Set distance
Label.Effect.OuterShadowEffect.Distance = 10;
//Set angle
Label.Effect.OuterShadowEffect.Direction = 90f;
//Save the file
ppt.SaveToFile("Shadow.pptx", FileFormat.Pptx2010);
}
}
}
Spire.Doc supports to insert new shapes to the word document and from version 6.4.11, Spire.Doc public the property ShapeObject.Rotation to enable developers to rotate the shapes. This article will show you to how to rotate the shapes on the word document in C#.
Step 1: Create a new instance of word document and load the document from file.
Document doc = new Document();
doc.LoadFromFile("Sample.docx");
Step 2: Get the first section from file.
Section section = doc.Sections[0];
Step 3: Traverse the word document and set the shape rotation as 10.
foreach (Paragraph para in section.Paragraphs)
{
foreach (DocumentObject obj in para.ChildObjects)
{
if (obj is ShapeObject)
{
(obj as ShapeObject).Rotation = 10.0;
}
}
}
Step 4: Save the document to file.
doc.SaveToFile("Result.docx", FileFormat.Docx);
Effective screenshot after rotate the shapes:

Full codes:
using Spire.Doc;
using Spire.Doc.Documents;
using Spire.Doc.Fields;
namespace Rotate
{
class Program
{
static void Main(string[] args)
{
Document doc = new Document();
doc.LoadFromFile("Sample.docx");
Section section = doc.Sections[0];
foreach (Paragraph para in section.Paragraphs)
{
foreach (DocumentObject obj in para.ChildObjects)
{
if (obj is ShapeObject)
{
(obj as ShapeObject).Rotation = 10.0;
}
}
}
doc.SaveToFile("Result.docx", FileFormat.Docx);
}
}
}
This tutorial is going to show you how to make a color of a image transparent using Spire.Doc.
Below screenshot shows an example image with black and white colors:

Detail steps:
Step 1: Instantiate a Document object and Load the Word file.
Document doc = new Document();
doc.LoadFromFile("Input.docx");
Step 2: Get the first Paragraph in the first section.
Paragraph paragraph = doc.Sections[0].Paragraphs[0];
Step 3: Set the black color of the image(s) in the paragraph to transperant.
foreach (DocumentObject obj in paragraph.ChildObjects)
{
if (obj is DocPicture)
{
(obj as DocPicture).TransparentColor = Color.Black;
}
}
Step 4: Save the file.
doc.SaveToFile("Result.docx", FileFormat.Docx2013);
Screenshot:

Full code:
using Spire.Doc;
using Spire.Doc.Documents;
using Spire.Doc.Fields;
using System.Drawing;
namespace Transeperant
{
class Program
{
static void Main(string[] args)
{
//Instantiate a Document object
Document doc = new Document();
//Load the Word file
doc.LoadFromFile("Input.docx");
//Get the first paragraph in the first section
Paragraph paragraph = doc.Sections[0].Paragraphs[0];
//Set the black color of the image(s) in the paragraph to transperant
foreach (DocumentObject obj in paragraph.ChildObjects)
{
if (obj is DocPicture)
{
(obj as DocPicture).TransparentColor = Color.Black;
}
}
//Save the file
doc.SaveToFile("Result.docx", FileFormat.Docx2013);
}
}
}