每一個我有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上一個問題,或刪除它,以避免重複。 –