Spread.Sheets
getCsv メソッド
開始行。
開始列。
行数。
列数。
行の最後に付加される行区切り文字。
列の最後に付加される列区切り文字。
範囲から区切り付きテキストを取得します。
シンタックス
Javascript (Usage) 
var instance = new GC.Spread.Sheets.Worksheet(name);
var value; // Type: string
value = instance.getCsv(row, column, rowCount, columnCount, rowDelimiter, columnDelimiter);
Javascript (Specification) 
function getCsv( 
   row : number,
   column : number,
   rowCount : number,
   columnCount : number,
   rowDelimiter : string,
   columnDelimiter : string
) : string;

パラメータ

row
開始行。
column
開始列。
rowCount
行数。
columnCount
列数。
rowDelimiter
行の最後に付加される行区切り文字。
columnDelimiter
列の最後に付加される列区切り文字。

戻り値の型

指定した区切り文字が付いた範囲内のテキスト。
使用例
This example adds data to a sheet, then saves it to a CSV file, then loads it in the second sheet.
var sheet1;
window.onload = function() {
var spread = new GC.Spread.Sheets.Workbook(document.getElementById('ss'), {sheetCount: 1});
        
sheet1 = spread.getSheet(0);
sheet1.setRowCount(3);
sheet1.setColumnCount(5);
sheet1.options.colHeaderAutoText = GC.Spread.Sheets.HeaderAutoText.blank;
sheet1.options.rowHeaderAutoText = GC.Spread.Sheets.HeaderAutoText.blank;
sheet1.setText(0, 0, "Row1", GC.Spread.Sheets.SheetArea.rowHeader);
sheet1.setText(1, 0, "Row2", GC.Spread.Sheets.SheetArea.rowHeader);
sheet1.setText(2, 0, "Row3", GC.Spread.Sheets.SheetArea.rowHeader);
sheet1.setText(0, 0, "Column1", GC.Spread.Sheets.SheetArea.colHeader);
sheet1.setText(0, 1, "Column2", GC.Spread.Sheets.SheetArea.colHeader);
sheet1.setText(0, 2, "Column3", GC.Spread.Sheets.SheetArea.colHeader);
sheet1.setText(0, 3, "Column4", GC.Spread.Sheets.SheetArea.colHeader);
sheet1.setText(0, 4, "Column5", GC.Spread.Sheets.SheetArea.colHeader);
sheet1.setText(0, 0, "SPREAD-1");
sheet1.setText(1, 0, "SPREAD-2");
sheet1.setText(2, 0, "SPREAD-3");
sheet1.setValue(0, 1, new Date().setFullYear(2006, 8, 1));
sheet1.setValue(1, 1, new Date().setFullYear(2006, 8, 2));
sheet1.setValue(2, 1, new Date().setFullYear(2006, 8, 3));
sheet1.setColumnWidth(1, 90);
sheet1.setValue(0, 2, 123.45);
sheet1.setValue(1, 2, 99.9999);
sheet1.setValue(2, 2, 100);
sheet1.setValue(0, 3, true);
sheet1.setValue(1, 3, false);
sheet1.setValue(2, 3, true);
sheet1.setValue(0, 4, "aaa");
sheet1.setValue(1, 4, "bbb");
sheet1.setValue(2, 4, "ccc");
            
$("#button1").click(function () {
    //Save all data on the first sheet in a csv format.
    window.CSVString = spread.getSheet(0).getCsv(0, 0, spread.getSheet(0).getRowCount(), spread.getSheet(0).getColumnCount(), "\r", ",");
});

$("#button2").click(function () {
    //Load the saved csv file on the second sheet.
    spread.addSheet(1, new GC.Spread.Sheets.Worksheet());
    spread.getSheet(1).setCsv(0, 0, window.CSVString, "\r", ",");
});
};

//Add button controls to page
<input type="button" id="button1" value="button1"/>
<input type="button" id="button2" value="button2"/>

関連トピック

参照

Worksheet タイプ
CSV形式データの取得と読み込み

 

 


© 2016-2017, GrapeCity inc. All rights reserved.