每一个我有HTML Web应用程序,我已经将Spreadsheet转换为HTML表格现在我想将此HTML Web应用程序表格转换为PDF。这如何实现?使用Google Apps脚本将HTML Web应用程序表转换为PDF
这里是我的代码
的index.html
<html>
<head>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("visualization", '1', {packages:['table']});
google.setOnLoadCallback(drawTable);
function drawTable() {
var query = new google.visualization.Query(
'https://docs.google.com/spreadsheets/d/1w5kqFmt1yclKVDdasujf-
moxjX3QOVsyDyP7DIcF2u0/edit#gid=0');
query.send(handleQueryResponse);
}
function handleQueryResponse(response) {
if (response.isError()) {
alert('Error in query: ' + response.getMessage() + ' ' +
response.getDetailedMessage());
return;
}
var data = response.getDataTable();
var table = new
google.visualization.Table(document.getElementById('table_div'));
var options = {'title':'Bass Naming',
'width':'600',
'height':'400'};
table.draw(data, options);
var tabUri = table.getLinkUrl();
}
</script>
<title>Data from a Spreadsheet</title>
</head>
<body>
<div>My Sheet</div>
<div id="table_div"></div>
<div>
<h3> click here the below button to send the Table as PDF to mail :</h3>
<button id='mail' onclick="myFunction()">Send to Mail</button>
</div>
</body>
</html>
code.gs
function doGet(e) {
return HtmlService
.createTemplateFromFile("index")
.evaluate()
.setTitle("Charts for Rent Analyser")
.setSandboxMode(HtmlService.SandboxMode.IFRAME);
}
你为什么要创建第二个问题似乎是同样的问题? (可能与[使用谷歌应用程序脚本将html表转换为pdf]重复(https://stackoverflow.com/questions/45072142/convert-html-table-to-pdf-using-google-app-script)) –
是* *没有人回应我以前的问题**我认为问题是**不清楚**所以我明确表示,我需要的是@ Pierre-Marie Richard –
然后,您应该考虑只编辑yyour上一个问题,或删除它,以避免重复。 –