Google电子表格导出为PDF的边距参数 [英] Margins parameters for Google spreadsheet export as PDF

查看:48
本文介绍了Google电子表格导出为PDF的边距参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要margins参数才能将电子表格导出为pdf.

I need the margins parameter to export my spreadsheet as a pdf.

我搜索了有关设置margins参数的信息,但找不到任何内容.以下参数运行良好.

I've searched for information about setting the margins parameter and can't find anything. The following parameters are working well.

var url_ext = 'exportFormat=pdf&format=pdf'        // export as pdf / csv / xls / xlsx
  + '&size=A4'                       // paper size legal / letter / A4
  + '&portrait=false'                    // orientation, false for landscape
  + '&fitw=true&source=labnol'           // fit to page width, false for actual size
  + '&sheetnames=false&printtitle=false' // hide optional headers and footers
  + '&pagenumbers=false&gridlines=false' // hide page numbers and gridlines
  + '&fzr=false'                         // do not repeat row headers (frozen rows) on each page
  + '&gid=';                             // the sheet's Id

推荐答案

实际上,可以设置边距并创建PDF.您只需要知道参数的名称及其可能的值.我已经可以使用这些

Actually, it's possible to set the margins and create a PDF. You just need to know the names of the parameters and their possible values. I've have got it to work with these

参数:

&format=pdf                   //export format
&size=a4                      //A3/A4/A5/B4/B5/letter/tabloid/legal/statement/executive/folio
&portrait=false               //true= Potrait / false= Landscape
&scale=1                      //1= Normal 100% / 2= Fit to width / 3= Fit to height / 4= Fit to Page
&top_margin=0.00              //All four margins must be set!
&bottom_margin=0.00           //All four margins must be set!
&left_margin=0.00             //All four margins must be set!
&right_margin=0.00            //All four margins must be set!
&gridlines=false              //true/false
&printnotes=false             //true/false
&pageorder=2                  //1= Down, then over / 2= Over, then down
&horizontal_alignment=CENTER  //LEFT/CENTER/RIGHT
&vertical_alignment=TOP       //TOP/MIDDLE/BOTTOM
&printtitle=false             //true/false
&sheetnames=false             //true/false
&fzr=false                    //true/false
&fzc=false                    //true/false
&attachment=false             //true/false

如您所见,PDF格式的参数比Internet上目前已知的更多.是的,似乎它们没有被Google记录在案.

As you can see there are more parameters for PDF formatting than currently known circulating around the Internet. Yes, it seems like they are not documented by Google.

如果PDF导出失败,则可能是不正确的值.某些参数对导出没有影响.例如:您正在使用 source = labnol ,这不是一个真实"参数,但不会造成任何麻烦.

If PDF export fails, it's probably an incorrect value. Some parameters do not have an effect on the Export. For example: your are using source=labnol, this is not a "real" parameter but it doesn't cause any trouble.

请确保您的网址中包含所有四个边距参数,如下所示:

Make sure you have all four margin parameters inside your url like this:

& top_margin = 0.00& bottom_margin = 0.00& left_margin = 0.00& right_margin = 0.00

否则它将无法创建PDF.

Otherwise it won't create the PDF.

希望有帮助!

这篇关于Google电子表格导出为PDF的边距参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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