如何使一个部分的第一页具有不同的页边距? [英] How to make the first page in a section have different margins?

查看:102
本文介绍了如何使一个部分的第一页具有不同的页边距?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用PHP创建Word文档.我已经弄清楚了如何设置一个部分的页边距.我还想出了如何为部分的第一页,甚至页面和默认页面设置页眉和页脚.我不知道如何设置页面的上边距,使其与部分中的第一页不同.

I'm using PHP to create Word documents. I've figured out how to set the page margins for a section. I've also figured out how to set headers and footers for the first page, even pages and default pages of a section. What I can't figure out is how to set the top margin of a page different for the first page in a section.

从本质上讲,我在该部分的第一页上具有较大的标题图像,并且需要将该页面的上边缘向下推至该部分所有其他页面上的顶部边缘的两倍.这有可能吗?知道如何在XML中进行操作会很不错,但是有人可以简单地告诉我如何通过Word UI进行操作,然后我可以查看生成的XML并找出来.

Essentially, I have a larger header image on the first page of the section and need to push the top margin of that page down twice as far as the top margins on all the other pages of the section. Is this something that is possible? Knowing how to do it in the XML would be nice but it someone could simply tell me how to do it through the Word UI I could then go look at the resulting XML and figure it out.

推荐答案

边距是在板块级别定义的,即,如果您要使用不同边距的页面,则需要为该页面创建一个新部分.

Margins are defined at the section level, i.e. if you want to have a page with different margins you need to create a new section for that page.

但是,如果您的目标是在第一页页眉中插入图像并向下移动所有内容,则无需额外的部分即可完成操作(不用说,您需要检查不同的第一页选项,以便图像仅显示在相应部分的首页上.您所要做的就是将图片的环绕样式设置为内联文本正方形顶部和底部(即可以为图片保留空间并且不将图片放在文字后或上方的任何选项).

If, however, your goal is to insert an image in the first page header and move everything down, this can be done without an extra section (It goes without saying that you need to check the Different first page option, so that the image only appears on the first page of the respective section). All you have to do is to set the wrapping style of your picture to be inline with text, square, tight or top and bottom (i.e. any option that will reserve space for the image and not put the image behind or above text).

最简单的方法是在Word中以所需的格式创建示例Word文档,并使用OpenXML SDK随附的文档反射器.

The easiest way is to create a sample Word document in Word with the desired formatting, and the use the document reflector that is included with the OpenXML SDK.

这篇关于如何使一个部分的第一页具有不同的页边距?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆