Skip to content

Instantly share code, notes, and snippets.

++++++++++++++++++++ สร้างฟังก์ชั่น จัดการ Font วางที่บรรทัด 246 ++++++++++++++++++++++++++
function createTable() {
pdfMake.fonts = {
THSarabun: {
normal: 'THSarabun.ttf',
bold: 'THSarabun-Bold.ttf',
italics: 'THSarabun-Italic.ttf',
bolditalics: 'THSarabun-BoldItalic.ttf'
},
Prompt: {
This file has been truncated, but you can view the full file.
this.pdfMake = this.pdfMake || {}; this.pdfMake.vfs = {
"THSarabun-Bold.ttf": "AAEAAAAYAQAABACAR0RFRgQiB0AAAXOIAAAANEdQT1OM1rlcAAFzvAAAF0ZHU1VC+npHzgABiwQAABqmTFRTSEA59scAAApcAAACAU9TLzKlWlR9AAACCAAAAGBQQ0xUhJ9GzQABc1AAAAA2VkRNWGiFb+oAAAxgAAAF4GNtYXCnLjp3AABASAAABoZjdnQgABQAAAAASEgAAAACZmVhdAAGBFcAAaWsAAAALGZwZ20GWZw3AABG0AAAAXNnYXNwABcACQABc0AAAAAQZ2x5ZoBj9bQAAEhMAADWFGhkbXhIFrcjAAASQAAALghoZWFk44Bw0AAAAYwAAAA2aGhlYQVUBCoAAAHEAAAAJGhtdHjEmvsNAAACaAAAB/RrZXJuvtnCrAABIlwAACE8bG9jYTuncdIAAR5gAAAD/G1heHAEOgQ6AAAB6AAAACBtb3J4A9e4DQABpdgAACYYbmFtZXNyEM4AAUOYAAAiqHBvc3Th7BqnAAFmQAAADP9wcmVwuAAAKwAASEQAAAAEAAEAAAABAABv2UP6Xw889QAZA+gAAAAAwTiFPAAAAADBOKkr/i7+NwOzA0wAAQAJAAIAAAAAAAAAAQAAA1L/BgAeA8z+Lv9aA7MAAQAAAAAAAAAAAAAAAAAAAf0AAQAAAf0B0gApAFEABgABAAAAAAAKAAACAAIVAAMAAQADAYwCvAAFAAACvAKKAAAAjAK8AooAAAHdAB4A+ggFAgsFAAQCAAIAA6EAAG9QACBaAAAAAAAAAABwc2sgACAAIPsCA1L/BgA8A1IA+mABAYOAAAAAAVQB3AAAACAADQK6ADUA3AAAAKgAJAEjADEBzgAhAW8AKwKwACcB5gAjAKkAMQD0ACwA9AALAVcAJwGhAB0ArAAZAOIADQCsACYBFP/iAXoAHAF6AEYBegAYAXoAGgF6ABwBe
@neno-tech
neno-tech / java.html
Created August 17, 2022 23:33
โค้ด Resize ภาพ
<script>
const WIDTH = 800
let myFile = document.getElementById("myFile")
myFile.addEventListener("change", (event) =>{
let image_file = event.target.files[0]
let reader = new FileReader
reader.readAsDataURL(image_file)
reader.onload = (event) => {
let image_url = event.target.result
let image = document.createElement("img")
@neno-tech
neno-tech / code.gs
Last active September 20, 2023 17:42
ครูอภิวัฒน์ สอนสร้างสื่อ web app ระบบลงชื่อเข้าใช้
function doGet(e) {
return HtmlService.createTemplateFromFile("index").evaluate()
.setTitle("ระบบ Login")
.addMetaTag('viewport', 'width=device-width, initial-scale=1')
.setXFrameOptionsMode(HtmlService.XFrameOptionsMode.ALLOWALL);
}
function processForm(formObject){
var concat = formObject.searchtext+formObject.searchtext2;
var result = "";
@neno-tech
neno-tech / code.gs
Created June 4, 2022 03:18
การสร้าง PDF จากชีตเฉพาะแถวที่ต้องการ
function onOpen() {
const ui = SpreadsheetApp.getUi();
ui.createMenu('สร้างรายงาน')
.addItem('PDF','myPDF')
.addToUi();
}
function myPDF(){
const data = checkSel();
if(data.sName == 'ชีต1' && data.results){
@neno-tech
neno-tech / code.gs
Last active January 27, 2024 14:10
Google Form + Line Notify
//ครูอภิวัฒน์ "สอนสร้างสื่อ"
function myFunction() {
var token = 'xxx'
var ss = SpreadsheetApp.openById('xxx')
var sh = ss.getSheetByName('xxx')
var row = sh.getLastRow();
var today = Utilities.formatDate(new Date(), "GMT+7", "dd/MM/yyyy")
var time = Utilities.formatDate(new Date(), "GMT+7", "HH:mm")
Logger.log(time)
@neno-tech
neno-tech / code.gs
Created April 26, 2022 05:12
โค้ด copy data from sheet to sheet
function copyData() {
importRange(
"xxx",
"yyy",
"xxx",
"yyy" );
}
function importRange(sourceID, sourceRange, targetID, targetRange) {
const sourceSS = SpreadsheetApp.openById(sourceID);
const sourceRng = sourceSS. getRange (sourceRange);
const FOLDER_ID = ''
const onFormSubmit = ({ response } = {}) => {
try {
const files = response
.getItemResponses()
.filter((itemResponse) => itemResponse.getItem().getType().toString() === 'FILE_UPLOAD')
.map((itemResponse) => itemResponse.getResponse())
.reduce((a, b) => [...a, ...b], []);
if (files.length > 0) {
const subfolderName = response.getItemResponses()[0].getResponse()//ดึงจากคำถามจากช่องกรอกชื่อ
@neno-tech
neno-tech / code.gs
Created April 15, 2022 00:22
การสร้างไอดีอัตโนมัติ
function doGet() {
return HtmlService.createTemplateFromFile("index")
.evaluate()
.addMetaTag('viewport', 'width=device-width, initial-scale=1')
.setXFrameOptionsMode(HtmlService.XFrameOptionsMode.ALLOWALL)
}
function addRecord(obj){
const ws = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet()
const data = ws.getRange(1,1,ws.getLastRow(),1).getValues()
var maxNum = 0
function doGet() {
return HtmlService.createTemplateFromFile("index")
.evaluate()
.addMetaTag('viewport', 'width=device-width, initial-scale=1')
.setXFrameOptionsMode(HtmlService.XFrameOptionsMode.ALLOWALL)
}
function getSheetData() {
var data = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet().getDataRange().getValues()
return data