個人所得税申告書フォーム

このデモでは、Spread.Sheetsを使用して、個人所得税申告書フォーム(米国個人税申告フォーム1040)のような複雑な入力フォームを簡単に作成する方法を紹介します。

<p>このデモでは、セルをロックして編集を禁止する方法や、テキストの垂直配置に焦点を当てるほか、<strong>fromJSON</strong>を使用して、事前定義されたテンプレートをロードする方法も紹介します。</p>
window.onload = function () { var spread = new GC.Spread.Sheets.Workbook(document.getElementById("ss"), { sheetCount: 1 }); initSpread(spread); }; function initSpread(spread) { var sd = data; if (sd.length > 0) { if (!spread) { return; } spread.suspendPaint(); spread.fromJSON(sd[0]); spread.options.tabStripVisible = false; var sheet = spread.getSheet(0); sheet.options.isProtected = true; sheet.options.gridline = { showHorizontalGridline: false, showVerticalGridline: false }; sheet.getRange(-1, 0, -1, sheet.getColumnCount(GC.Spread.Sheets.SheetArea.rowHeader), GC.Spread.Sheets.SheetArea.rowHeader).visible(false); sheet.getRange(0, -1, sheet.getRowCount(GC.Spread.Sheets.SheetArea.colHeader), -1, GC.Spread.Sheets.SheetArea.colHeader).visible(false); var style = sheet.getStyle(1, 1, GC.Spread.Sheets.SheetArea.viewport); if (style) { style.wordWrap = true; sheet.setStyle(1, 1, style); } style = sheet.getStyle(3, 3, GC.Spread.Sheets.SheetArea.viewport); if (style) { style.wordWrap = true; sheet.setStyle(3, 3, style); } style = sheet.getStyle(7, 1, GC.Spread.Sheets.SheetArea.viewport); if (style) { style.wordWrap = true; sheet.setStyle(7, 1, style); } style = sheet.getStyle(5, 1, GC.Spread.Sheets.SheetArea.viewport); if (style) { style.wordWrap = true; sheet.setStyle(5, 1, style); } style = sheet.getStyle(9, 1, GC.Spread.Sheets.SheetArea.viewport); if (style) { style.wordWrap = true; sheet.setStyle(9, 1, style); } style = sheet.getStyle(15, 1, GC.Spread.Sheets.SheetArea.viewport); if (style) { style.wordWrap = true; sheet.setStyle(15, 1, style); sheet.setStyle(21, 1, style); } style = sheet.getStyle(31, 1, GC.Spread.Sheets.SheetArea.viewport); if (style) { style.wordWrap = true; sheet.setStyle(31, 1, style); } style = sheet.getStyle(37, 1, GC.Spread.Sheets.SheetArea.viewport); if (style) { style.wordWrap = true; sheet.setStyle(37, 1, style); } style = sheet.getStyle(41, 1, GC.Spread.Sheets.SheetArea.viewport); if (style) { style.wordWrap = true; sheet.setStyle(41, 1, style); } style = sheet.getStyle(46, 1, GC.Spread.Sheets.SheetArea.viewport); if (style) { style.wordWrap = true; sheet.setStyle(46, 1, style); } style = sheet.getStyle(17, 22, GC.Spread.Sheets.SheetArea.viewport); if (style) { style.wordWrap = true; sheet.setStyle(17, 22, style); } style = sheet.getStyle(19, 12, GC.Spread.Sheets.SheetArea.viewport); if (style) { style.wordWrap = true; sheet.setStyle(19, 12, style); sheet.setStyle(19, 16, style); sheet.setStyle(19, 18, style); } style = sheet.getStyle(8, 21, GC.Spread.Sheets.SheetArea.viewport); if (style) { style.wordWrap = true; sheet.setStyle(8, 21, style); } style = sheet.getStyle(10, 21, GC.Spread.Sheets.SheetArea.viewport); if (style) { style.wordWrap = true; sheet.setStyle(10, 21, style); } style = sheet.getStyle(13, 1, GC.Spread.Sheets.SheetArea.viewport); if (style) { style.font = "normal bold 14px Calibri"; sheet.setStyle(13, 1, style); sheet.setStyle(17, 1, style); sheet.setStyle(28, 1, style); } style = sheet.getStyle(46, 1, GC.Spread.Sheets.SheetArea.viewport); if (style) { style.font = "normal bold 14px Calibri"; style.wordWrap = true; sheet.setStyle(46, 1, style); } spread.resumePaint(); } }
<!doctype html> <html style="height:100%;font-size:14px;"> <head> <meta name="spreadjs culture" content="ja-jp" /> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <link rel="stylesheet" type="text/css" href="$DEMOROOT$/ja/purejs/node_modules/@grapecity/spread-sheets/styles/gc.spread.sheets.excel2013white.css"> <script src="$DEMOROOT$/ja/purejs/node_modules/@grapecity/spread-sheets/dist/gc.spread.sheets.all.min.js" type="text/javascript"></script> <script src="$DEMOROOT$/ja/purejs/node_modules/@grapecity/spread-sheets-resources-ja/dist/gc.spread.sheets.resources.ja.min.js" type="text/javascript"></script> <script src="$DEMOROOT$/spread/source/js/license.js" type="text/javascript"></script> <script src="$DEMOROOT$/spread/source/data/taxform.js" type="text/javascript"></script> <script src="app.js" type="text/javascript"></script> <link rel="stylesheet" type="text/css" href="styles.css"> </head> <body> <div class="sample-tutorial"> <div id="ss" style="width:100%;height:100%"></div> </div> </body> </html>
.sample-tutorial { position: relative; height: 100%; overflow: hidden; } body { position: absolute; top: 0; bottom: 0; left: 0; right: 0; }