标签: presentationml

使用Java生成PowerPoint 2007/2010文件

有没有人知道任何可以通过Java生成/编辑PowerPoint 2007/2010演示文稿的API(商业或开源).我有一个PowerPoint 2007/2010格式的模板,我需要编辑/更新.到目前为止,我一直在将.pptx文件转换为xml,然后编辑并将其存储为.pptx.但是文件在打开时会被破坏.

是否有人知道在Java中执行此操作的任何其他方法或API?

java powerpoint presentationml

18
推荐指数
3
解决办法
3万
查看次数

在Powerpoint幻灯片中更改文本框中的文本

我有一个包含3张幻灯片的Powerpoint演示文稿.每张幻灯片都有一个文本框,它是一个占位符.我想替换一张幻灯片上的文本框内容.

我需要知道如何使用C#和OpenXML来做到这一点

万分感谢

openxml presentationml

6
推荐指数
1
解决办法
2723
查看次数

在OpenXML(PresentationML)PowerPoint(PPTX)中计算文本(TextBody)的大小(范围)

我想创建一个包含来自数据库的数据的演示文稿.我设法获得在PowerPoint中打开的有效演示文稿(SDK 2.5 的Open XML Productivity Tool对此有很大帮助).但是,如何计算文本框形状的大小?我看到放置值的位置,但new Extents()默认为零宽度和高度.当我Shape从现有演示文稿中获取a的某些值时,我可能会获得正确的高度(至少对于带有一行或固定行数的文本),但文本将溢出到右侧或底部(取决于wordwrap)设置).

也将NormalAutoFitBodyPropertiesTextBody不帮助-为必要的值FontScaleLineSpaceReduction没有在计算的OpenXML.

那么,设置Extentsa 的最佳做法ShapeTextBody什么?

是否有内置的方法来计算Extents给定的TextBodyShape?(内置方法的一些经验法则会比什么都好)

我知道PowerPoint将重新计算NormalAutoFit任何更改后的值(至少在更改之前和之后的一堆幻灯片),但是在更改之前启动演示文稿时(或者如果它是从PowerPoint查看器开始).

c# powerpoint openxml openxml-sdk presentationml

6
推荐指数
1
解决办法
1051
查看次数

从模板创建PowerPoint 2007演示文稿

我需要使用Open XML Format SDK 2.0从模板创建PowerPoint 2007演示文稿.模板必须由客户提供,并用于单独的布局样式(字体,背景颜色或图像,......).它需要包含两个预定义的幻灯片:

  • 文字幻灯片
  • 图片幻灯片

应用程序现在应该创建模板文件的副本,创建文本和图像幻灯片的多个副本,并用一些内容替换内容占位符.

我已经从Microsoft找到了一些代码片段来编辑幻灯片的标题,删除幻灯片或替换幻灯片上的图像.但我没有找到如何创建现有幻灯片的副本.也许有人可以帮我这个.

.net c# powerpoint openxml presentationml

5
推荐指数
1
解决办法
8880
查看次数

当内容使用Open XML SDK 2.0从当前幻灯片流出时,如何将表拆分为新的PowerPoint幻灯片

我有一堆数据需要从网站导出到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)

openxml openxml-sdk presentationml

5
推荐指数
1
解决办法
6799
查看次数

PPTX - 查找文本是否是OpenXML中的项目符号

我找不到任何可以告诉我txBody标签中的文字是否带项目符号的指示器,你能不能指出我应该用哪个指示器来理解文本是否是项目符号?

-谢谢

openxml presentationml

5
推荐指数
1
解决办法
627
查看次数

OpenXML-为演示文稿中的幻灯片设置幻灯片布局

这是我用来创建演示文稿的代码。

我在这里尝试的是创建一张幻灯片并将形状插入其中并将幻灯片附加到已创建的演示文稿中。这很好用。

我的问题是如何设置插入幻灯片的布局。我的意思是这里的幻灯片布局是

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)

powerpoint openxml presentation openxml-sdk presentationml

1
推荐指数
1
解决办法
1888
查看次数