ExcelHome技术论坛

 找回密码
 免费注册

QQ登录

只需一步,快速开始

快捷登录

搜索
EH技术汇-专业的职场技能充电站 妙哉!函数段子手趣味讲函数 Excel服务器-会Excel,做管理系统 Excel Home精品图文教程库
HR薪酬管理数字化实战 Excel 2021函数公式学习大典 Excel数据透视表实战秘技 打造核心竞争力的职场宝典
300集Office 2010微视频教程 数据工作者的案头书 免费直播课集锦 ExcelHome出品 - VBA代码宝免费下载
用ChatGPT与VBA一键搞定Excel WPS表格从入门到精通 Excel VBA经典代码实践指南
查看: 2084|回复: 5

[分享] 通过xml突破PowerPoint一些限制(1)

[复制链接]

TA的精华主题

TA的得分主题

发表于 2019-6-18 10:24 | 显示全部楼层 |阅读模式

昨天编辑了半天,发现文章超出了论坛限制,今天改成几篇来发。
本文逼格有点高,读者慎入。




我们在Excel里面使用表格,创建自己的表格样式是非常简单的事情(如下图所示,注意红线圈出的地方);Word里面也有表格样式,甚至内容更丰富。

Exceltbl.png

然而,这么简单的功能,在PowerPoint里面却成为了黑客级别的技术!!!普通的PPT文档,是不能创建自定义表格的。虽然说,你用内置的某个表格样式后,可以编辑这个样式,但总归不如自定义的方便。

PPTtbl.png

那能否创建自定义表格呢?答案是肯定的,需要通过修改PPT文档的xml代码来实现。下面的文字内容来自于老外博客,我偷懒用有道词典翻译过来了,可能个别的地方读起来怪怪的,但总归理解没有问题。





XML Hacking: Custom Table Styles
Posted on July 13, 2015        - Updated on August 7, 2018
For branded documents, you want to have a unique table style. Microsoft Office programs include a pile of table styles that are auto-created by the software, but they all have that generic MS look. It's possible to create custom styles in Excel and Word for both Windows and Mac using the program interface. But if you're using PowerPopint, you can still create custom table styles. You just have to hack some XML!
对于品牌文档,您希望具有独特的表风格。Microsoft Office程序包括一堆表格样式,这些样式是由软件自动创建的,但它们都具有通用的MS外观。可以使用程序界面在Excel和Word中为Windows和Mac创建自定义样式。但如果使用PowerPopint,仍然可以创建自定义表样式。您只需要破解一些XML!

First we have to cover how Office programs create custom tables. It's not a simple subject, but understanding this will also help you if you're trying to create custom table styles in Word for Windows or Excel, which actually have tools to do this in the respective programs.
首先,我们必须介绍Office程序如何创建自定义表。这不是一个简单的主题,但如果您试图在Word中为Windows或Excel创建自定义表样式,理解这一点也会有所帮助,因为Word或Excel实际上在各自的程序中都有实现这一点的工具。

Let's start by making one thing clear: table styles do not format the font choice or size contained in the tables. Yes, I know the Word and Excel table style tools have font formatting dropdowns, yes I know Microsoft help files say that font styling is included in table styles. The truth is that font styling in a table style is limited to setting bold or italic attributes, font color and whether the table component uses the Headings or Body font as specced in the Font Theme. For typeface and size, alignment and weight/italic controls, read my post on Default Table Text
让我们首先明确一件事:表样式不格式化表中包含的字体选择或大小。是的,我知道Word和Excel表格样式工具有字体格式下拉菜单,是的,我知道微软的帮助文件说字体样式包含在表格样式中。事实是,表格样式中的字体样式仅限于设置粗体或斜体属性、字体颜色以及表格组件是否使用标题或主体字体作为字体主题中的指定字体。有关字体和大小、对齐方式和重量/斜体控件,请阅读我在默认表文本上的文章

I find that it's easier to format Office tables if I imagine that table formatting has layers. The base layer is any overall formatting that applies to the table as a whole. Then, we build layers on top of that base formatting that looks after the Header Row, probably the most common feature applied to tables. We follow this with the Total Row, the bottom one. Next, the First and Last Columns. Once these outer areas are formatted, we add layers for Even and Odd Row Banding and then Even and Odd Column Banding. Finally, we can spec special formatting for the cells in the 4 corners. This sequence moves from the general to the particular and also from the most common to the rarest formatting.
我发现,如果假设表格格式化有多个层,那么格式化办公室表格会更容易。基本层是应用于整个表的所有总体格式。然后,我们在负责头行(可能是应用于表的最常见特性)的基本格式之上构建层。我们在后面加上一行,最后一行。接下来是第一列和最后一列。一旦这些外部区域被格式化,我们就为偶数和奇数行带和偶数和奇数列带添加层。最后,我们可以为四个角的单元格指定特殊的格式。这个序列从一般格式转换为特殊格式,也从最常见的格式转换为最罕见的格式。

This sequence is how the table style dialogs in Word for Windows and Excel present table elements. It's similar to the order in which we enter the information in an XML custom table style. If you follow this order, you'll get a custom style in much less time than if, for instance, you try to start with the even and odd rows.
这个序列是Word和Excel中的表格样式对话框如何显示表格元素的。它类似于以XML自定义表样式输入信息的顺序。如果按照这个顺序,得到自定义样式所需的时间要比从偶数行和奇数行开始所需的时间短得多。

Word's custom table styles are stored in the styles.xml file. This is in the word folder of an unzipped file. The comparable file for PowerPoint is called tableStyles.xml in the ppt folder. The XML is similar in concept, but the differences mean you can't copy and paste from one program to another. If you're not sure where to find these files, please read XML Hacking:An Introduction. If you're editing on a Mac, you should also read XML Hacking: Editing in OS X
Word的自定义表样式存储在styles.xml文件中。这是在一个解压缩文件的word文件夹中。PowerPoint的类似文件在ppt文件夹中称为tableStyles.xml。XML在概念上是相似的,但是不同之处在于您不能从一个程序复制粘贴到另一个程序。如果您不确定在哪里可以找到这些文件,请阅读XML Hacking:An Introduction。如果您在Mac上编辑,还应该阅读XML Hacking: editing in OS X

Here's a typical PowerPoint table style. I've broken the listing into 4 pieces so it fits on the page. Copy and paste them together into one listing, or download it as a zipped text file:
这是一个典型的PowerPoint表格风格。我把这个清单分成了4个部分,所以它适合放在页面上。将它们复制粘贴到一个列表中,或者以压缩文本文件的形式下载:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<a:tblStyle styleId="{0817EA92-75D0-4044-A80A-286907CE0DDB}" styleName="Custom Table Style" >
  <a:wholeTbl >
    <a:tcTxStyle >
      <a:fontRef idx="minor" >
        <a:prstClr val="black"/ >
      </a:fontRef >
      <a:schemeClr val="dk1"/ >
    </a:tcTxStyle >
    <a:tcStyle >
      <a:tcBdr >
        <a:left >
          <a:ln w="0" cmpd="sng" >
            <a:solidFill >
              <a:schemeClr val="bg1"/ >
            </a:solidFill >
          </a:ln >
        </a:left >
        <a:right >
          <a:ln w="0" cmpd="sng" >
            <a:solidFill >
              <a:schemeClr val="bg1"/ >
            </a:solidFill >
          </a:ln >
        </a:right >
        <a:top >
          <a:ln w="0" cmpd="sng" >
            <a:solidFill >
              <a:schemeClr val="bg1"/ >
            </a:solidFill >
          </a:ln >
        </a:top >
        <a:bottom >
          <a:ln w="0" cmpd="sng" >
            <a:solidFill >
              <a:schemeClr val="bg1"/ >
            </a:solidFill >
          </a:ln >
        </a:bottom >
        <a:insideH >
          <a:ln w="114300" cmpd="sng" >
            <a:solidFill >
              <a:schemeClr val="bg1"/ >
            </a:solidFill >
          </a:ln >
        </a:insideH >
        <a:insideV >
          <a:ln w="114300" cmpd="sng" >
            <a:solidFill >
              <a:schemeClr val="bg1"/ >
            </a:solidFill >
          </a:ln >
        </a:insideV >
      </a:tcBdr >
      <a:fill >
        <a:solidFill >
          <a:srgbClr val="F5F9FD"/ >
        </a:solidFill >
      </a:fill >
    </a:tcStyle >
  </a:wholeTbl >
  <a:band1H >
    <a:tcStyle >
      <a:tcBdr/ >
      <a:fill >
        <a:solidFill >
          <a:schemeClr val="accent6"/ >
        </a:solidFill >
      </a:fill >
    </a:tcStyle >
  </a:band1H >
  <a:band2H >
    <a:tcStyle >







未完,请继续阅读第2篇。



PPTtbl2.png

TA的精华主题

TA的得分主题

 楼主| 发表于 2019-6-18 10:27 | 显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用  · 内置多项VBA编程加强工具       ★ 免费下载 ★      ★使用手册

通过xml突破PowerPoint的一些限制(2)

第二部分:





      <a:tcBdr/ >
    </a:tcStyle >
  </a:band2H >
  <a:band1V >
    <a:tcStyle >
      <a:tcBdr/ >
      <a:fill >
        <a:solidFill >
          <a:srgbClr val="F5F9FD"/ >
        </a:solidFill >
      </a:fill >
    </a:tcStyle >
  </a:band1V >
  <a:band2V >
    <a:tcStyle >
      <a:tcBdr/ >
    </a:tcStyle >
  </a:band2V >
  <a:lastCol >
    <a:tcTxStyle >
      <a:fontRef idx="minor" >
        <a:prstClr val="black"/ >
      </a:fontRef >
      <a:schemeClr val="lt1"/ >
    </a:tcTxStyle >
    <a:tcStyle >
      <a:tcBdr/ >
      <a:fill >
        <a:solidFill >
          <a:srgbClr val="999999"/ >
        </a:solidFill >
      </a:fill >
    </a:tcStyle >
  </a:lastCol >
  <a:firstCol >
    <a:tcTxStyle >
      <a:fontRef idx="minor" >
        <a:prstClr val="black"/ >
      </a:fontRef >
      <a:schemeClr val="dk2"/ >
    </a:tcTxStyle >
    <a:tcStyle >
      <a:tcBdr/ >
      <a:fill >
        <a:solidFill >
          <a:srgbClr val="F3F3F4"/ >
        </a:solidFill >
      </a:fill >
    </a:tcStyle >
  </a:firstCol >
  <a:lastRow >
    <a:tcTxStyle >
      <a:fontRef idx="minor" >
        <a:prstClr val="black"/ >
      </a:fontRef >
      <a:schemeClr val="dk1"/ >
    </a:tcTxStyle >
    <a:tcStyle >
      <a:tcBdr >
        <a:top >
          <a:ln w="114300" cmpd="sng" >
            <a:solidFill >
              <a:schemeClr val="lt1"/ >
            </a:solidFill >
          </a:ln >
        </a:top >
      </a:tcBdr >
      <a:fill >
        <a:solidFill >
          <a:srgbClr val="CCCCCC"/ >
        </a:solidFill >
      </a:fill >
    </a:tcStyle >
  </a:lastRow >
  <a:firstRow >
    <a:tcTxStyle >
      <a:fontRef idx="minor" >
        <a:prstClr val="black"/ >
      </a:fontRef >
      <a:schemeClr val="lt1"/ >
    </a:tcTxStyle >
    <a:tcStyle >
      <a:tcBdr >
        <a:bottom >
          <a:ln w="114300" cmpd="sng" >
            <a:solidFill >
              <a:schemeClr val="lt1"/ >
            </a:solidFill >
          </a:ln >
        </a:bottom >
      </a:tcBdr >
      <a:fill >
        <a:solidFill >
          <a:schemeClr val="dk2"/ >
        </a:solidFill >
      </a:fill >
    </a:tcStyle >
  </a:firstRow >
</a:tblStyle >

Breaking Down Custom Table Styles
That's a big pile of XML to throw at you. Let's break it down, first, the section that sets parameters for the whole table. Think of this like a layer cake, with the WholeTbl section being the first layer. Then later attributes are superimposed on top of it.
分解自定义表样式
这是一大堆XML。首先,让我们将它分解为为整个表设置参数的部分。把它想象成一个层蛋糕,第一层是whole etbl部分。然后将后面的属性叠加在上面。

From line 3 to 8, we set the font charcteristics that we can: idx="minor" means the font will be the theme body font. The actual font used is set in the theme, not here. Line 5 sets the font color, in this case the Office Preset Color black.
从第3行到第8行,我们设置了可以设置的字体特性:idx="minor"表示该字体将是主题主体字体。实际使用的字体是在主题中设置的,不在这里。第5行设置字体颜色,在本例中为Office预置颜色黑色。

Line 9 begins formatting the default borders. As one example, line 12 sets the weight for the left border w=0, meaning it has a 0 thickness and does not display. If it did display, the color setting in line 14 would set it to bg1, or the first background color, normally white in most themes. By contrast, look at line 40 for Inside Horizontal borders (the ones between each cell. Here the weight is set w=114300. The measurement units are EMUs or English Metric Unit, a made-up measurement system that allows easy conversion between English and Metric systems. At 914400 EMUs per inch, it means the line weight is 1/8 of an inch, unusually thick borders for a table.
第9行开始格式化默认边框。例如,第12行设置左边框的权重w=0,这意味着它的厚度为0,不显示。如果它显示了,第14行中的颜色设置将把它设置为bg1,或者第一个背景颜色,在大多数主题中通常为白色。相比之下,请查看第40行内水平边框(每个单元格之间的边框)。这里的权重设置为w=114300。计量单位是EMUs或英语公制单位,这是一个虚构的计量系统,可以方便地在英语和公制之间转换。在每英寸914400 EMUs,这意味着线的重量是1/8英寸,对于一个表来说,这是非常厚的边框。

Then, starting on line 54, are the fill settings for default cells. Line 57 set them to an RGB color value, since this is a tint not found in the theme. The color notation is hexadecimal, just as on an HTML page.
然后,从第54行开始,是默认单元格的填充设置。第57行将它们设置为RGB颜色值,因为这是在主题中找不到的颜色。颜色符号是十六进制的,就像在HTML页面上一样。

Color Models
One of my readers pointed out that I hadn't covered the different color models well, and that's important. Here are the different ways you can spec color. Use the same syntax for fonts, borders and fills:
颜色模型
我的一位读者指出,我没有很好地涵盖不同的颜色模型,这一点很重要。这里有几种不同的方法可以指定颜色。字体、边框和填充使用相同的语法:

<a:prstClr>: These are a very limited range of named colors that were used in early versions of Microsoft Office, when only 8 or 16 colors were available. They're just here for legacy file format support, but you'll see them used in some XML sample listings.
An example would be <a:prstClr val="black"/>.
<a:prstClr>:这些是非常有限的命名颜色,在早期版本的Microsoft Office中使用,当时只有8或16种颜色可用。它们只是用于支持遗留文件格式,但您将在一些XML示例清单中看到它们。
例如<a:prstClr val="black"/>。

<a:schemeClr>: These access the Theme Colors. For the 2 pairs of light and dark colors that form the first 4 in a theme, you may see them variously as lt1, dk1, lt2 and dk2, or bg1, tx1, bg2 and tx2. Be careful with using the last 4, because Office Open XML allows mapping other colors to bg and tx. The safer choices are lt and dk. These are followed by the 6 accent colors: accent1 through accent6. Finally hlink and folHlink designate the hyperlink and followed hyperlink colors.
Examples are <a:schemeClr val="lt1"/> or <a:schemeClr val="accent2"/>.
<a:schemeClr>:这些访问主题颜色。对于构成主题前4种颜色的两对明暗颜色,您可以将它们分别视为lt1、dk1、lt2和dk2,或者bg1、tx1、bg2和tx2。使用后4种颜色时要小心,因为Office Open XML允许将其他颜色映射到bg和tx,更安全的选择是lt和dk。然后是6种强调色:埃森哲1到埃森哲6。最后,hlink和folHlink指定超链接并跟随超链接的颜色。
例如<a:schemeClr val="lt1"/>或<a:schemeClr val="accent2"/>。

<a:srgbClr>: Sometimes you need colors that are not in the theme. This color model uses hexadecimal colors, exactly the same as used in HTML.
<a:srgbClr val="F5F9FD"/> is one example.
<a:srgbClr>:有时候你需要主题中没有的颜色。这个颜色模型使用十六进制颜色,与HTML中使用的颜色完全相同。
<a:srgbClr val="F5F9FD"/>就是一个例子。

<a:scrgbClr>: This is also RGB, but uses percentages instead of hexadecimal:
<a:scrgbClr r="50%" g="50%" b="50%"/>.
<a:scrgbClr>:这也是RGB,但是使用百分数而不是十六进制:
<a:scrgbClr r="50%" g="50%" b="50%"/>。

<a:hslClr>: If you need to use HSL (Hue, Saturation and Luminance), this is the model for you.
Try <a:hslClr hue="14400000" sat="100%" lum="50%"/>.
<a:hslClr>:如果你需要使用HSL(色调,饱和度和亮度),这是你的模型。
试着<:hslClr色调=“14400000”=“100%”烟囱= " 50% " / >。






TA的精华主题

TA的得分主题

 楼主| 发表于 2019-6-18 10:29 | 显示全部楼层

通过xml突破PowerPoint的一些限制(3)

本帖最后由 hxhgxy 于 2019-6-18 10:33 编辑

第三部分:




<a:sysClr>: This model allows you to use operating system colors. Beware, you'll get different results in OS X then in Windows, and users can customize their system colors as well.
<a:sysClr val="windowText"/>.
<a:sysClr>:这个模型允许您使用操作系统颜色。注意,你会在OS X中得到不同的结果,然后在Windows中,用户也可以自定义他们的系统颜色。
<a:sysClr val = " windowText " / >。

01 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
02 <a:tblStyle styleId="{0817EA92-75D0-4044-A80A-286907CE0DDB}" styleName="Custom Table Style" >

整个表格
03   <a:wholeTbl >
04     <a:tcTxStyle >                                        表格单元格文本样式
05       <a:fontRef idx="minor" >                字体参考
06         <a:prstClr val="black"/ >                预设颜色
07       </a:fontRef >
08       <a:schemeClr val="dk1"/ >                调色板颜色
09     </a:tcTxStyle >
10     <a:tcStyle >                                        表格单元格文本样式
11       <a:tcBdr >                                        表格单元格边框
12         <a:left >                                        左边边框
13           <a:ln w="0" cmpd="sng" >
14             <a:solidFill >
15               <a:schemeClr val="bg1"/ >
16             </a:solidFill >
17           </a:ln >
18         </a:left >
19         <a:right >                                        右边边框
20           <a:ln w="0" cmpd="sng" >
21             <a:solidFill >
22               <a:schemeClr val="bg1"/ >
23             </a:solidFill >
24           </a:ln >
25         </a:right >
26         <a:top >                                        上边边框
27           <a:ln w="0" cmpd="sng" >
28             <a:solidFill >
29               <a:schemeClr val="bg1"/ >
30             </a:solidFill >
31           </a:ln >
32         </a:top >
33         <a:bottom >                                下边边框
34           <a:ln w="0" cmpd="sng" >
35             <a:solidFill >
36               <a:schemeClr val="bg1"/ >
37             </a:solidFill >
38           </a:ln >
39         </a:bottom >
40         <a:insideH >                                表格内部水平边框
41           <a:ln w="114300" cmpd="sng" >
42             <a:solidFill >
43               <a:schemeClr val="bg1"/ >
44             </a:solidFill >
45           </a:ln >
46         </a:insideH >
47         <a:insideV >                                表格内部竖直边框
48           <a:ln w="114300" cmpd="sng" >
49             <a:solidFill >
50               <a:schemeClr val="bg1"/ >
51             </a:solidFill >
52           </a:ln >
53         </a:insideV >
54       </a:tcBdr >
55       <a:fill >                                                表格填充颜色
56         <a:solidFill >
57           <a:srgbClr val="F5F9FD"/ >        RGB颜色
58         </a:solidFill >
59       </a:fill >
60     </a:tcStyle >
61   </a:wholeTbl >

Custom Table Style Layers
Next up is the section for the odd and even-numbered horizontal bands:
自定义表样式层
接下来是奇数和偶数横带部分:

62   <a:band1H >                                                奇数行
63     <a:tcStyle >
64       <a:tcBdr/ >
65       <a:fill >
66         <a:solidFill >
67           <a:schemeClr val="accent6"/ >
68         </a:solidFill >
69       </a:fill >
70     </a:tcStyle >
71   </a:band1H >
72   <a:band2H >                                                偶数行
73     <a:tcStyle >
74       <a:tcBdr/ >
75     </a:tcStyle >
76   </a:band2H >

In XML, an empty or unused attribute closes itself, as does the final object in a chain of references. Line 64 shows <a:tcBdr/ > with a slash right after the name. The slash closes the border attribute, indicating that adding odd-number row formatting doesn’t include a change to the borders. On the other hand, the fill is active, using the Accent 6 color from the theme. Accent 6 closes itself because it’s the final item of information in defining the fill.
在XML中,空的或未使用的属性会自动关闭,引用链中的最后一个对象也是如此。第64行显示<a:tcBdr/ >,名称后面有一个斜杠。斜杠关闭边框属性,表示添加奇数行格式不包括对边框的更改。另一方面,填充是活动的,使用主题的重音颜色。重音6自动关闭,因为它是定义填充的最后一项信息。

Compare lines 72 to 76 (even-numbered rows) with 63 to 71 (odd-numbered rows). No format was set for even-numbered horizontal rows, so applying this attribute in Office will have no effect on the table appearance.
比较第72行到76行(偶数行)和63行到71行(奇数行)。没有为偶数水平行设置格式,因此在Office中应用此属性对表的外观没有影响。

Next up are banded columns. This is similar to the banded row section: odd-numbered rows are defined, but not even-numbered. The fill color is a hexadecimal RGB, value, since this color is not in the theme:
接下来是带状列。这类似于带状行部分:定义奇数行,但不定义偶数行。填充颜色是十六进制的RGB值,因为这个颜色不在主题中:

77   <a:band1V >                                                奇数列
78     <a:tcStyle >
79       <a:tcBdr/ >
80       <a:fill >
81         <a:solidFill >
82           <a:srgbClr val=”F5F9FD”/ >
83         </a:solidFill >
84       </a:fill >
85     </a:tcStyle >
86   </a:band1V >
97   <a:band2V >                                                偶数列
98     <a:tcStyle >
99       <a:tcBdr/ >
100     </a:tcStyle >
101   </a:band2V >

After banded rows and columns, we proceed to first/last rows and columns, more layers in the cake. Here's the XML for the Last (rightmost) Column:
在带状行和列之后,我们继续进行第一行/最后一行和列,蛋糕中有更多的层。下面是最后一列(最右边)的XML:

102   <a:lastCol >                                        最后一列
103     <a:tcTxStyle >
104       <a:fontRef idx="minor" >
105         <a:prstClr val="black"/ >
106       </a:fontRef >
107       <a:schemeClr val="lt1"/ >
108     </a:tcTxStyle >
109     <a:tcStyle >
110       <a:tcBdr/ >
111       <a:fill >
112         <a:solidFill >
113           <a:srgbClr val="999999"/ >
114         </a:solidFill >
115       </a:fill >
116     </a:tcStyle >
117   </a:lastCol >

This contains sections for font, border and fill parameters. As with the whole table section, font formatting is limited to speccing which theme font and color to use. No borders are assigned and the fill color is an RGB gray. Here are the remaining parameters for the First (leftmost) Column, the the last (bottom) row and first (top) row. In the Office interface, the top-most row is referred to as the Header Row and the bottom-most as the Total Row.
它包含字体、边框和填充参数的部分。与整个表格部分一样,字体格式仅限于指定要使用的主题字体和颜色。没有指定边框,填充颜色为RGB灰色。下面是第一列(最左边)、最后一行(底部)和第一行(顶部)的剩余参数。在Office接口中,最上面的行称为头行,最下面的行称为总行。

Clearly, when you edit this XML by hand, you'll need to be familiar with the custom color theme used in the file and its hex values. Read my post on this subject: XML Hacking: Color Themes Next time we'll take a look at how table styles connect with the Office program interface to give the user access to these features
显然,当手工编辑这个XML时,需要熟悉文件中使用的自定义颜色主题及其十六进制值。阅读我关于这个主题的文章:XML黑客:颜色主题下次我们将研究表样式如何与Office程序接口相连接,从而使用户能够访问这些特性

As always, if this seems too daunting, Brandwares is here to create custom table styles for you. Contact me at production@brandwares.com
一如既往,如果这看起来太吓人,brandware在这里为您创建定制的表格样式。请通过production@brandwares.com联系我






TA的精华主题

TA的得分主题

 楼主| 发表于 2019-6-18 10:49 | 显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用  · 内置多项VBA编程加强工具       ★ 免费下载 ★      ★使用手册

通过xml突破PowerPoint的一些限制(4)

第四部分:




XML Hacking: Table Styles Complete
Posted on August 31, 2015 -Updated on January 19, 2019
Custom Table Styles are probably one of the moredetailed hacks you'll have to write. See the constructions details in my previous post. Besidesthe basic table format, there are 6 optional format layers you need to at leastconsider. In a minimal table style, you'll need to include at least the HeaderRow, First Column and Banded Rows. Most users will expect to see these options.Total Rows, Last Columns and Banded Columns are less requested, you only needto include them if a design or client specifically requires them.
定制表样式可能是您需要编写的更详细的技巧之一。请参阅我之前的文章中的构造细节。除了基本的表格格式之外,至少还有6个可选的格式层需要考虑。在最小表样式中,至少需要包含标题行、第一列和带状行。大多数用户都希望看到这些选项。总行、最后一列和带状列的请求更少,只有在设计或客户端特别需要时才需要包含它们。
As mentioned in part 1, if you haven't hacked XMLbefore, please read XML Hacking: An Introduction.If you're using a Mac, you should also read XML Hacking: Editing in OS X.In addition, an essential companion to this pair of articles is the post onsetting Default Table Text,which is set in a different XML component..
Let's take a look at how our work appears in thePowerPoint interface. First, we'll insert a plain vanilla table. By defaultthis takes on colors and fonts from the current PowerPoint theme:
正如第1部分中提到的,如果您以前没有破解过XML,请阅读XML Hacking: An Introduction。如果您使用的是Mac,还应该阅读XML Hacking: Editing in OS X.此外,这两篇文章的一个基本伴侣是关于设置默认表文本的文章,它是在另一个XML组件中设置的。
让我们来看看我们的工作如何出现在PowerPoint界面。首先,我们将插入一个普通的表。默认情况下,它采用当前PowerPoint主题的颜色和字体:
                              
Next, we choose the Table Tools>Design tab, openthe Table Styles gallery. Up at the top a new Custom section has appeared withour new custom table style:
接下来,我们选择TableTools>Design选项卡,打开Table Stylesgallery。在顶部出现了一个新的自定义部分与我们的新自定义表风格:
  
Select the custom table style and the default tablechanges to match our design. This screen shot has all formatting options turnedoff, so effectively we are seeing the Whole Table formatting only.
选择自定义表样式和默认表更改以匹配我们的设计。这个屏幕截图关闭了所有格式化选项,因此实际上我们只看到整个表的格式化。
  
Options: Banded Rows and Header
Using the options panel in the upper left corner,we can add some of optional formatting layers we created in XML. First, let'sturn on banded rows. If you remember, we only formatted odd-numbered rows, sothe banding only changes rows 1 and 3 in our example:
选项:带状行和头文件
使用左上角的options面板,我们可以添加一些用XML创建的可选格式化层。首先,让我们打开带状行。如果你还记得,我们只格式化奇数行,所以在我们的例子中,条带只改变了第1行和第3:
  
Next, we'll leave banded rows on and also add theHeader row. This row doesn't count as part of the table body, so the bandingmoves down 1 row:
接下来,我们将保留带状行,并添加标题行。这一行不作为表体的一部分,所以带向下移动1:
  
Options: First and Last Columns
Next, we'll turn off banded rows, leave the Headeras is and add the first column:
选项:第一列和最后一列
接下来,我们将关闭带状行,保持标题不变,并添加第一列:
  
Here's the table with First and Last Columns checked:
  
Options: Header and Total
And finally, Header and Total Rows:
选项:HeaderTotal
最后,标题和总行:
  
As you can see, with some pre-planning, one tablestyle can cover quite a few related table looks. The layer options fordifferent features make the table useful for many different purposes and theoptions panel makes it fast and easy for users to try different combinations.This feature is a major advance over tables in PowerPoint 2003 and earlier,which were quite crude by comparison. Table styles work the same way in Word,PowerPoint and Excel. While Word and Excel include table style editors in theirinterface, PowerPoint needs to be hacked to create them. Happy hacking!
正如您所看到的,通过一些预先计划,一个表样式可以涵盖相当多的相关表外观。针对不同特性的层选项使表适用于许多不同的用途,而选项面板使用户可以快速、轻松地尝试不同的组合。与PowerPoint 2003和更早的版本相比,这个特性是一个重大的进步,相比之下,PowerPoint 2003和更早版本的版本相当粗糙。表格样式在WordPowerPointExcel中工作方式相同。WordExcel的界面中都包含了表格风格的编辑器,而PowerPoint需要破解才能创建它们。黑客快乐!
Of course, if the process is too complex, we'rehere to help. The current price on a custom table style is US$120. Just emailme production@brandwares.com
当然,如果这个过程太复杂,我们会在这里提供帮助。自定义桌面样式的当前价格为120美元。给我发邮件production@brandwares.com





原文中的截图都自动被删除了,没有关系,不需要。
下面的代码是我创建橙色自定义表格的xml代码,其中,我基于原文,增加了对第一行的参数设置——firstRow。
遗留的问题,表格里的文本格式没法修改!

<a:tblStyle styleId="{0817EA92-75D0-4044-A80A-AAA907CE0FDD}" styleName="Tiger Table Orange">
<a:wholeTbl>
<a:tcTxStyle>
<a:fontRef idx="minor">
<a:prstClr val="black"/>
</a:fontRef>
<a:schemeClr val="dk1"/>
</a:tcTxStyle>
<a:tcStyle>
<a:tcBdr>
<a:left>
<a:ln w="0" cmpd="sng">
<a:solidFill>
<a:schemeClr val="bg1"/>
</a:solidFill>
</a:ln>
</a:left>
<a:right>
<a:ln w="0" cmpd="sng">
<a:solidFill>
<a:schemeClr val="bg1"/>
</a:solidFill>
</a:ln>
</a:right>
<a:top>
<a:ln w="20000" cmpd="sng">
<a:solidFill>
<a:srgbClr val="C8500E"/>
</a:solidFill>
</a:ln>
</a:top>
<a:bottom>
<a:ln w="20000" cmpd="sng">
<a:solidFill>
<a:srgbClr val="C8500E"/>
</a:solidFill>
</a:ln>
</a:bottom>
<a:insideH>
<a:ln w="0" cmpd="sng">
<a:solidFill>
<a:srgbClr val="7F7F7F"/>
</a:solidFill>
</a:ln>
</a:insideH>
<a:insideV>
<a:ln w="0" cmpd="sng">
<a:solidFill>
<a:schemeClr val="bg1"/>
</a:solidFill>
</a:ln>
</a:insideV>
</a:tcBdr>
</a:tcStyle>
</a:wholeTbl>
<a:band1H>
<a:tcStyle>
<a:tcBdr/>
</a:tcStyle>
</a:band1H>
<a:band2H>
<a:tcStyle>
<a:tcBdr/>
<a:fill>
<a:solidFill>
<a:srgbClr val="FCE9DC"/>
</a:solidFill>
</a:fill>
</a:tcStyle>
</a:band2H>
<a:band1V>
<a:tcStyle>
<a:tcBdr/>
</a:tcStyle>
</a:band1V>
<a:band2V>
<a:tcStyle>
<a:tcBdr/>
</a:tcStyle>
</a:band2V>
<a:firstRow>
<a:tcStyle>
<a:tcBdr>
<a:bottom>
<a:ln w="20000" cmpd="sng">
<a:solidFill>
<a:srgbClr val="C8500E"/>
</a:solidFill>
</a:ln>
</a:bottom>
</a:tcBdr>
<a:fill>
<a:solidFill>
<a:srgbClr val="DF590F"/>
</a:solidFill>
</a:fill>
</a:tcStyle>
</a:firstRow>
</a:tblStyle>

PPTtbl2.png

TA的精华主题

TA的得分主题

 楼主| 发表于 2019-6-18 11:04 | 显示全部楼层
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件       ★免费下载 ★       ★ 使用帮助

通过xml突破PowerPoint的一些限制(4)

本帖最后由 hxhgxy 于 2019-6-19 09:02 编辑

重复的内容——已删除。
PPTtbl2.png

TA的精华主题

TA的得分主题

发表于 2019-7-6 13:55 | 显示全部楼层
谢谢分享经验 收藏之 先学基础 打好基础了再研究这些自定义的

TA的精华主题

TA的得分主题

发表于 2019-7-11 15:00 | 显示全部楼层
您需要登录后才可以回帖 登录 | 免费注册

本版积分规则

手机版|关于我们|联系我们|ExcelHome

GMT+8, 2024-5-21 01:08 , Processed in 0.051024 second(s), 14 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 1999-2023 Wooffice Inc.

沪公网安备 31011702000001号 沪ICP备11019229号-2

本论坛言论纯属发表者个人意见,任何违反国家相关法律的言论,本站将协助国家相关部门追究发言者责任!     本站特聘法律顾问:李志群律师

快速回复 返回顶部 返回列表