有没有人知道任何可以通过Java生成/编辑PowerPoint 2007/2010演示文稿的API(商业或开源).我有一个PowerPoint 2007/2010格式的模板,我需要编辑/更新.到目前为止,我一直在将.pptx文件转换为xml,然后编辑并将其存储为.pptx.但是文件在打开时会被破坏.
是否有人知道在Java中执行此操作的任何其他方法或API?
我有一个包含3张幻灯片的Powerpoint演示文稿.每张幻灯片都有一个文本框,它是一个占位符.我想替换一张幻灯片上的文本框内容.
我需要知道如何使用C#和OpenXML来做到这一点
万分感谢
我想创建一个包含来自数据库的数据的演示文稿.我设法获得在PowerPoint中打开的有效演示文稿(SDK 2.5 的Open XML Productivity Tool对此有很大帮助).但是,如何计算文本框形状的大小?我看到放置值的位置,但new Extents()
默认为零宽度和高度.当我Shape
从现有演示文稿中获取a的某些值时,我可能会获得正确的高度(至少对于带有一行或固定行数的文本),但文本将溢出到右侧或底部(取决于wordwrap)设置).
也将NormalAutoFit
在BodyProperties
的TextBody
不帮助-为必要的值FontScale
并LineSpaceReduction
没有在计算的OpenXML.
那么,设置Extents
a 的最佳做法Shape
是TextBody
什么?
是否有内置的方法来计算Extents
给定的TextBody
或Shape
?(内置方法的一些经验法则会比什么都好)
我知道PowerPoint将重新计算NormalAutoFit
任何更改后的值(至少在更改之前和之后的一堆幻灯片),但是在更改之前启动演示文稿时(或者如果它是从PowerPoint查看器开始).
我需要使用Open XML Format SDK 2.0从模板创建PowerPoint 2007演示文稿.模板必须由客户提供,并用于单独的布局样式(字体,背景颜色或图像,......).它需要包含两个预定义的幻灯片:
应用程序现在应该创建模板文件的副本,创建文本和图像幻灯片的多个副本,并用一些内容替换内容占位符.
我已经从Microsoft找到了一些代码片段来编辑幻灯片的标题,删除幻灯片或替换幻灯片上的图像.但我没有找到如何创建现有幻灯片的副本.也许有人可以帮我这个.
我有一堆数据需要从网站导出到PowerPoint演示文稿,并且一直使用Open XML SDK 2.0来执行此任务.我有一个PowerPoint演示文稿,我通过Open XML SDK 2.0 Productivity Tool生成模板代码,我可以用它来重新创建导出.
在其中一张幻灯片上,我有一张表,要求是向该表添加数据,如果表格超出幻灯片的底部,则会在多张幻灯片中中断该表格.我采取的方法是确定表格的高度,如果它超过幻灯片的高度,将新内容移动到下一张幻灯片中.我已经阅读了Bryan和Jones的博客,将重复数据添加到PowerPoint幻灯片中,但我的情况有点不同.他们使用以下代码:
A.Table tbl = current.Slide.Descendants<A.Table>().First();
A.TableRow tr = new A.TableRow();
tr.Height = heightInEmu;
tr.Append(CreateDrawingCell(imageRel + imageRelId));
tr.Append(CreateTextCell(category));
tr.Append(CreateTextCell(subcategory));
tr.Append(CreateTextCell(model));
tr.Append(CreateTextCell(price.ToString()));
tbl.Append(tr);
imageRelId++;
Run Code Online (Sandbox Code Playgroud)
这对我来说不起作用,因为他们知道设置表行的高度,因为它将是图像的高度,但是当添加不同数量的文本时,我不知道提前的高度所以我只是设置tr.Height
为默认值.这是我在桌子高度计算的尝试:
A.Table tbl = tableSlide.Slide.Descendants<A.Table>().First();
A.TableRow tr = new A.TableRow();
tr.Height = 370840L;
tr.Append(PowerPointUtilities.CreateTextCell("This");
tr.Append(PowerPointUtilities.CreateTextCell("is"));
tr.Append(PowerPointUtilities.CreateTextCell("a"));
tr.Append(PowerPointUtilities.CreateTextCell("test"));
tr.Append(PowerPointUtilities.CreateTextCell("Test"));
tbl.Append(tr);
tableSlide.Slide.Save();
long tableHeight = PowerPointUtilities.TableHeight(tbl);
Run Code Online (Sandbox Code Playgroud)
以下是帮助方法:
public static A.TableCell CreateTextCell(string text)
{
A.TableCell tableCell = new A.TableCell(
new A.TextBody(new A.BodyProperties(),
new A.Paragraph(new A.Run(new A.Text(text)))),
new A.TableCellProperties()); …
Run Code Online (Sandbox Code Playgroud) 我找不到任何可以告诉我txBody标签中的文字是否带项目符号的指示器,你能不能指出我应该用哪个指示器来理解文本是否是项目符号?
-谢谢
这是我用来创建演示文稿的代码。
我在这里尝试的是创建一张幻灯片并将形状插入其中并将幻灯片附加到已创建的演示文稿中。这很好用。
我的问题是如何设置插入幻灯片的布局。我的意思是这里的幻灯片布局是
slideLayoutpart.SlideLayout = new SlideLayout() {
Type = SlideLayoutValues.VerticalTitleAndText
};
Run Code Online (Sandbox Code Playgroud)
我想将此布局设置为我的幻灯片。
我曾在此处使用幻灯片布局
Slide slide = new Slide(new CommonSlideData(new ShapeTree()));
uint drawingObjectId = 1;
// Construct the slide content.
// Specify the non-visual properties of the new slide.
NonVisualGroupShapeProperties nonVisualProperties = slide.CommonSlideData.ShapeTree.AppendChild(new NonVisualGroupShapeProperties());
nonVisualProperties.NonVisualDrawingProperties = new NonVisualDrawingProperties() { Id = 1, Name = "" };
nonVisualProperties.NonVisualGroupShapeDrawingProperties = new NonVisualGroupShapeDrawingProperties();
nonVisualProperties.ApplicationNonVisualDrawingProperties = new ApplicationNonVisualDrawingProperties();
// Specify the group shape properties of the new slide.
slide.CommonSlideData.ShapeTree.AppendChild(new GroupShapeProperties()); …
Run Code Online (Sandbox Code Playgroud)