简体   繁体   English

将SlideMaster和SlideLayouts添加到演示文稿中

[英]Adding SlideMasters and SlideLayouts to a Presentation

I am trying to create a presentation with six Slides, three Master Slides (MS-A, MS-B, and MS-C), and two Slide Layouts (SL-1 and SL-2). 我试图用六个幻灯片,三个主幻灯片(MS-A,MS-B和MS-C)和两个幻灯片布局(SL-1和SL-2)创建演示文稿。 Think of the six Slides as two rows and three columns of Slides. 将六个幻灯片视为幻灯片的两行和三列。

I want to create the first 'row' of slides all using a SlideMaster that reference Slide Layout 1. For example, Slide 1 (S1A) would be created using Master MS-A which references SL-1. 我想使用引用幻灯片布局1的SlideMaster创建所有幻灯片的第一个“行”。例如,将使用引用SL-1的Master MS-A创建幻灯片1(S1A)。 Slide 2 (S1B) with MS-B that references SL-1, and Slide (S1C) with MS-C that references SL-1. 带有SL-1的带有MS-B的幻灯片2(S1B)和带有SL-1的带有MS-C的幻灯片(S1C)。

So far, this should be no real problem. 到目前为止,这应该不是真正的问题。 However, I want to know if it is possible to build the second 'row' of Slides (S2A, S2B, and S2C) with Master Slides MS-A through MS-C where they reference Slide Layout SC-2, and without affecting the contents of the first row of Slides 但是,我想知道是否可以使用主幻灯片MS-A到MS-C在参考幻灯片布局SC-2的情况下构建幻灯片的第二个“行”(S2A,S2B和S2C),而又不影响幻灯片第一行的内容

If this is possible, can you provide me links / examples / pseudo code of how I would go about doing this? 如果可以的话,您能提供我如何执行此操作的链接/示例/伪代码吗?

I am using OpenXML 2.5, C#, Framework 4.5. 我正在使用OpenXML 2.5,C#,Framework 4.5。

  • A presentation may have one or more slide masters (master). 演示文稿可以具有一个或多个幻灯片母版(母版)。
  • Each master may have one or more slide layouts (layout). 每个母版可以具有一个或多个幻灯片版式(布局)。
  • Each layout is related to one-and-only-one master. 每种布局都与一个唯一的母版相关。
  • Each slide is related to one-and-only-one layout. 每张幻灯片都与一个唯一的布局有关。 There is no direct relationship of a slide to a master, only the indirect relationship through its layout. 幻灯片与母版没有直接关系,只有通过布局的间接关系。

Not sure if that answers your question, I can't fully understand it the way you've formulated it. 不确定是否能回答您的问题,我无法完全按照您制定的方式来理解。 Slides are distinct from both masters and layouts. 幻灯片不同于母版和版式。 I'm not sure if you're saying you want six slides are six layouts, or both. 我不确定您是说要六张幻灯片是六张布局,还是两者都要。

Also I can't help you with implementation using C#, but its probably a good idea to get straight what you're trying to accomplish and whether it's possible first anyway :) 同样,我也无法帮助您使用C#进行实现,但是弄清您要完成的工作以及是否有可能首先实现它可能是一个好主意:)

If you wanted six slides, each based on one of six distinct layouts, each based pair-wise on one of three masters, it would go something like this in psuedo-code: 如果您想要六张幻灯片,每张幻灯片基于六个不同布局之一,每张成对基于三个母版之一,那么它将在伪代码中像这样:

m_1 = Presentation.add_master(M_1)
m_2 = Presentation.add_master(M_2)
m_3 = Presentation.add_master(M_3)

l_1a = m_1.add_layout(L_1A)
l_1b = m_1.add_layout(L_1B)
l_2a = m_2.add_layout(L_2A)
l_2b = m_2.add_layout(L_2B)
l_3a = m_3.add_layout(L_3A)
l_3b = m_3.add_layout(L_3B)

slide_1 = Presentation.Slides.add_slide(based_on=l_1a)
slide_2 = Presentation.Slides.add_slide(based_on=l_1b)
slide_3 = Presentation.Slides.add_slide(based_on=l_2a)
slide_4 = Presentation.Slides.add_slide(based_on=l_2b)
slide_5 = Presentation.Slides.add_slide(based_on=l_3a)
slide_6 = Presentation.Slides.add_slide(based_on=l_3b)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM