在PPT演示文稿中访问形状的MediaFormat属性时出错0x80048010。 [英] Error 0x80048010 while accessing MediaFormat property of a shape in PPT presentation.

查看:58
本文介绍了在PPT演示文稿中访问形状的MediaFormat属性时出错0x80048010。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问候,

我有一个奇怪的问题。我用几张幻灯片创建了一个PPT演示文稿。我还在第一页(mp3歌曲)放置了一个媒体文件。当我在我的应用程序中迭代幻灯片中的所有幻灯片和所有形状时,我发现这个媒体形状,即表达式
" pShape-> Type == Office :: MsoShapeType :: msoMedia"是真的。在此检查之后,我尝试让MediaFormat稍后更改播放音频的音量:"PowerPoint :: MediaFormatPtr pMedia = pShape-> MediaFormat;"。这个表达式生成
我错误  0x80048010。有什么建议?我做错了什么?

I have a weird problem. I've created a PPT presentation with couple of slides. I also placed a media file at the first page (mp3 song). When I'm iterating all the slides and all the shapes at the slide in my application, I find this media shape, i.e. expression "pShape->Type == Office::MsoShapeType::msoMedia" is true. After this check I try to get MediaFormat to change the volume of playing audio later: "PowerPoint::MediaFormatPtr pMedia = pShape->MediaFormat;". And this expression generates me an error 0x80048010. Any advice? What am I doing wrong?

推荐答案

您好
Dima Kostenich,

你曾提到过,"经过这次检查我尝试让MediaFormat稍后改变播放音频的音量:"PowerPoint :: MediaFormatPtr pMedia = pShape-> MediaFormat;"。这个表达式生成错误  0x80048010。 "

you had mentioned that,"After this check I try to get MediaFormat to change the volume of playing audio later: "PowerPoint::MediaFormatPtr pMedia = pShape->MediaFormat;". And this expression generates me an error 0x80048010. "

我尝试使用下面的代码进行测试,以更改媒体文件的音量。我发现它没有任何错误。

I try to make a test using code below to change the volume of media file. I find that it works without any error.

你可以尝试在你身边进行测试。

you can try to test it on your side.

using PowerPoint = Microsoft.Office.Interop.PowerPoint;
using Office = Microsoft.Office.Core;


 private void Form1_Load(object sender, EventArgs e)
        {
            PowerPoint.Application app = new PowerPoint.Application();
            app.Visible = Office.MsoTriState.msoTrue;
           
            app.Presentations.Open(@"C:\Users\v-padee\Desktop\demo.pptx");

            foreach (PowerPoint.Slide slide in app.ActivePresentation.Slides)
            {
                PowerPoint.Shapes slideShapes = slide.Shapes;
                foreach (PowerPoint.Shape shape in slideShapes)
                {
                    if (shape.Type == Office.MsoShapeType.msoMedia &&
                        shape.MediaType == PowerPoint.PpMediaType.ppMediaTypeSound)
                    {
                       
                        MessageBox.Show(shape.MediaFormat.Volume.ToString());
                        shape.MediaFormat.Volume = 1;
                        MessageBox.Show(shape.MediaFormat.Volume.ToString());
                       
                    }
                }
            }

        }

问候

Deepak


这篇关于在PPT演示文稿中访问形状的MediaFormat属性时出错0x80048010。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆