Knowledgebase (2328)
Children categories
C# Set animation effect for the animate text on the presentation slides
2018-01-24 08:24:09 Written by KoohjiWe have already demonstrated how to set the animations on shapes in PowerPoint. Now Spire.Presentation starts to support set the Animation Effect for the type and time of the animate text. This article will show you how to use IterateType property and IterateTimeValue property for animation Effect to set the type and time of animate text in C#.
Firstly, view the original sample document with animate text effect with "All at once".

Step 1: Create a presentation instance and load the sample document from file.
Presentation ppt = new Presentation();
ppt.LoadFromFile("Sample.pptx",FileFormat.Pptx2010);
Step 2: Set the AnimateType as Letter.
ppt.Slides[0].Timeline.MainSequence[0].IterateType = Spire.Presentation.Drawing.TimeLine.AnimateType.Letter;
Step 3: Set the IterateTimeValue for the animate text.
ppt.Slides[0].Timeline.MainSequence[0].IterateTimeValue = 10;
Step 4: Save the document to file.
ppt.SaveToFile("Result.pptx", FileFormat.Pptx2010);
Effective screenshot of the animation effect for the animate text effect with "by Letter".


This article demonstrates how to print different pages of a PDF document to different printer trays using Spire.PDF and c#.
Code snippets:
Step 1: Initialize an object of PdfDocument class and Load the PDF document.
PdfDocument doc = new PdfDocument(); doc.LoadFromFile(@"F:\sample.pdf");
Step 2: Set different printer trays for different pages of the document.
doc.PrintSettings.PaperSettings += delegate(object sender, PdfPaperSettingsEventArgs e)
{
//Set the paper source of page 1-50 as tray 1
if (1 <= e.CurrentPaper && e.CurrentPaper <= 50)
{
e.CurrentPaperSource = e.PaperSources[0];
}
//Set the paper source of the rest of pages as tray 2
else
{
e.CurrentPaperSource = e.PaperSources[1];
}
};
Step 3: Print the document.
doc.Print();
Full code:
using Spire.Pdf;
using Spire.Pdf.Print;
namespace Print_pages_to_different_printer_trays
{
class Program
{
static void Main(string[] args)
{
//Initialize an object of PdfDocument class
PdfDocument doc = new PdfDocument();
//Load the PDF document
doc.LoadFromFile(@"F:\sample.pdf");
//Set Paper source
doc.PrintSettings.PaperSettings += delegate(object sender, PdfPaperSettingsEventArgs e)
{
//Set the paper source of page 1-50 as tray 1
if (1 <= e.CurrentPaper && e.CurrentPaper <= 50)
{
e.CurrentPaperSource = e.PaperSources[0];
}
//Set the paper source of the rest of pages as tray 2
else
{
e.CurrentPaperSource = e.PaperSources[1];
}
};
//Print the document
doc.Print();
}
}
}
Preserve Theme When Copying Sections from One Word Document to Another in C#
2018-01-19 08:04:49 Written by KoohjiA theme is a set of colors, fonts, and effects that determines the overall look of your Word document. Suppose you have a document which is neat and stylish, you’d like to copy contents of a section to another document without losing the theme and style. You can clone the theme to destination file using CloneThemeTo method.
Step 1: Create a Document object and load a sample Word file.
Document doc = new Document();
doc.LoadFromFile("theme.docx");
Step 2: Create a new Word document.
Document newWord = new Document();
Step 3: Clone default style, theme, compatibility from the source file to destination document.
doc.CloneDefaultStyleTo(newWord); doc.CloneThemesTo(newWord); doc.CloneCompatibilityTo(newWord);
Step 4: Add the cloned section to destination document.
newWord.Sections.Add(doc.Sections[0].Clone());
Step 5: Save the file.
newWord.SaveToFile("result.docx", FileFormat.Docx);
Output:

Full Code:
using Spire.Doc;
namespace PreserveTheme
{
class Program
{
static void Main(string[] args)
{
Document doc = new Document();
doc.LoadFromFile("theme.docx");
Document newWord = new Document();
doc.CloneDefaultStyleTo(newWord);
doc.CloneThemesTo(newWord);
doc.CloneCompatibilityTo(newWord);
newWord.Sections.Add(doc.Sections[0].Clone());
newWord.SaveToFile("result.docx", FileFormat.Docx);
}
}
}