Spire.Presentation 10.10.1 现已发布,此更新引入了设置音频淡入和淡出持续时间的功能,以及裁剪音频的能力。以下是详细信息:
新功能:
- 支持设置音频的淡入或淡出持续时间。
- 支持裁剪音频。
// New Append Audio
Presentation pres = new Presentation();
FileStream from_stream = File.OpenRead(inputFile);
RectangleF audioRect = new RectangleF(50, 50, 100, 100);
IAudio audio = pres.Slides[0].Shapes.AppendAudioMedia(from_stream, audioRect);
// Set the duration of the starting fade for 13s
audio.FadeInDuration = 13000f;
// Set the duration of the ending fade for 40s
audio.FadeOutDuration = 10000f;
pres.SaveToFile(outputFile, FileFormat.Pptx2013);
// Retrieve existing documents
FileStream from_stream = File.OpenRead(inputFile);
Presentation presentation = new Presentation();
presentation.LoadFromStream(from_stream, FileFormat.Auto);
foreach (IShape shape in presentation.Slides[0].Shapes)
{
if (shape is IAudio)
{
IAudio audio = shape as IAudio;
// Set the duration of the starting fade for 13s
audio.FadeInDuration = 13000f;
// Set the duration of the ending fade for 20s
audio.FadeOutDuration = 20000f;
}
}
presentation.SaveToFile(outputFile, FileFormat.Pptx2013);
// New Append Audio
Presentation pres = new Presentation();
FileStream from_stream = File.OpenRead(inputFile);
RectangleF audioRect = new RectangleF(50, 50, 100, 100);
IAudio audio = pres.Slides[0].Shapes.AppendAudioMedia(from_stream, audioRect);
// Set the start trimming time 8 seconds
audio.TrimFromStart = 8000f;
// Set the end trimming time 13 seconds
audio.TrimFromEnd = 13000f;
pres.SaveToFile(outputFile, FileFormat.Pptx2013);
// Retrieve existing documents
FileStream from_stream = File.OpenRead(inputFile);
Presentation presentation = new Presentation();
presentation.LoadFromStream(from_stream, FileFormat.Auto);
foreach (IShape shape in presentation.Slides[0].Shapes)
{
if (shape is IAudio)
{
IAudio audio = shape as IAudio;
// Set the start trimming time 8 seconds
audio.TrimFromStart = 8000f;
// Set the end trimming time 13 seconds
audio.TrimFromEnd = 13000f;
}
}
presentation.SaveToFile(outputFile, FileFormat.Pptx2013);
Spire.Presentation 10.10.1 支持设置音频淡入和淡出持续时间
https://www.e-iceblue.cn/Downloads/Spire-Presentation-NET.html







