AddAudioFrameEmbedded

AddAudioFrameEmbedded(float, float, float, float, Stream)

在集合的末尾添加一个带有嵌入音频文件的新音频框。嵌入的音频文件只能是WAV格式。它将新音频添加到Presentation.Audios列表中。

public IAudioFrame AddAudioFrameEmbedded(float x, float y, float width, float height, 
    Stream audio_stream)
参数类型描述
xSingle新音频框的X坐标。
ySingle新音频框的Y坐标。
widthSingle新音频框的宽度。
heightSingle新音频框的高度。
audio_streamStream带音频数据的输入流。

返回值

创建的AudioFrame对象。

示例

以下示例演示了如何创建音频框。

[C#]
// Instantiates a presentation class that represents a presentation file
using (Presentation pres = new Presentation())
{
    // Gets the first slide
    ISlide sld = pres.Slides[0];
    // Loads the the wav sound file to stream
    FileStream fstr = new FileStream("sampleaudio.wav", FileMode.Open, FileAccess.Read);
    // Adds the Audio Frame
    IAudioFrame audioFrame = sld.Shapes.AddAudioFrameEmbedded(50, 150, 100, 100, fstr);
    // Sets the Play Mode and Volume of the Audio
    audioFrame.PlayMode = AudioPlayModePreset.Auto;
    audioFrame.Volume = AudioVolumeMode.Loud;
    // Writes the PowerPoint file to disk
    pres.Save("AudioFrameEmbed_out.pptx", SaveFormat.Pptx);
}

另请参见


AddAudioFrameEmbedded(float, float, float, float, IAudio)

在集合的末尾添加一个带有嵌入音频文件的新音频框。它使用来自Presentation.Audios列表的音频文件。

public IAudioFrame AddAudioFrameEmbedded(float x, float y, float width, float height, IAudio audio)
参数类型描述
xSingle新音频框的X坐标。
ySingle新音频框的Y坐标。
widthSingle新音频框的宽度。
heightSingle新音频框的高度。
audioIAudio来自Presentation.Audios列表的音频。

返回值

创建的AudioFrame对象。

另请参见