PowerTools SPREAD for ASP.NET 8.0J
SaveTextFileRange(Int32,Int32,Int32,Int32,String,Boolean,IncludeHeaders,String,String,String,Encoding) メソッド

行の開始インデックス
列の開始インデックス
行数
列数
セル範囲の保存先ファイルのパスとファイル名
データを書式なしで保存するかどうかを表すブール値
どのヘッダセルのデータを保存するか
行区切り文字列
列区切り文字列
セル区切り文字列
エンコーディング
セル範囲(およびヘッダ)を指定したテキストファイルに保存します。
構文
'Declaration
 
Public Overloads Function SaveTextFileRange( _
   ByVal row As Integer, _
   ByVal column As Integer, _
   ByVal rowCount As Integer, _
   ByVal columnCount As Integer, _
   ByVal fileName As String, _
   ByVal unformatted As Boolean, _
   ByVal includeHeaders As IncludeHeaders, _
   ByVal rowDelimiter As String, _
   ByVal columnDelimiter As String, _
   ByVal cellDelimiter As String, _
   ByVal encoding As Encoding _
) As Boolean

パラメータ

row
行の開始インデックス
column
列の開始インデックス
rowCount
行数
columnCount
列数
fileName
セル範囲の保存先ファイルのパスとファイル名
unformatted
データを書式なしで保存するかどうかを表すブール値
includeHeaders
どのヘッダセルのデータを保存するか
rowDelimiter
行区切り文字列
columnDelimiter
列区切り文字列
cellDelimiter
セル区切り文字列
encoding
エンコーディング
次のサンプルコードは、SaveTextFileRangeメソッドを使用します。
FpSpread1.Sheets[0].RowCount = 6;
FpSpread1.Sheets[0].ColumnCount = 6;
FpSpread1.Sheets[0].Cells[0, 0, 5, 5].Text = "test";
FpSpread1.Sheets[0].ColumnHeader.Cells[0, 0].Text = "Custom";
FpSpread1.Sheets[0].Cells[0, 0].BackColor = System.Drawing.Color.CadetBlue;

protected void Button1_Click(object sender, EventArgs e)
{
    //FpSpread1.Sheets[0].SaveTextFileRange(0, 0, 5, 5, "c:\\controls\\textfile.txt", true, FarPoint.Web.Spread.Model.IncludeHeaders.None, "#", "", "^");
    //FpSpread1.Sheets[0].SaveTextFileRange(0, 0, 5, 5, "c", "^");
    //FpSpread1.Sheets[0].SaveTextFileRange(0, 0, 5, 5, "c:\\controls\\textfile.txt", true, FarPoint.Web.Spread.Model.IncludeHeaders.None, "#", "", "^", System.Text.Encoding.ASCII);
    //FpSpread1.Sheets[0].SaveTextFileRange(0, 0, 5, 5, "c", "^", System.Text.Encoding.ASCII);
    //FpSpread1.Sheets[0].SaveTextFileRange(0, 0, 5, 5, "c:\\controls\\textfile.txt", false, FarPoint.Web.Spread.Model.IncludeHeaders.ColumnHeadersCustomOnly, false, "#", "", "^", false);
    //FpSpread1.Sheets[0].SaveTextFileRange(0, 0, 5, 5, "c", "^", false);
    //FpSpread1.Sheets[0].SaveTextFileRange(0, 0, 5, 5, "c:\\controls\\textfile.txt", false, FarPoint.Web.Spread.Model.IncludeHeaders.ColumnHeadersCustomOnly, false, "#", "", "^", false, System.Text.Encoding.ASCII);
    //FpSpread1.Sheets[0].SaveTextFileRange(0, 0, 5, 5, "c", "^", false, System.Text.Encoding.ASCII);
    //FpSpread1.Sheets[0].SaveTextFileRange(0, 0, 5, 5, "c:\\controls\\textfile.txt", false, FarPoint.Web.Spread.Model.IncludeHeaders.ColumnHeadersCustomOnly, "#", "%", "^", false, System.Text.Encoding.ASCII, false);
     FpSpread1.Sheets[0].SaveTextFileRange(0, 0, 5, 5, "c:\\controls\\textfile.txt", false, FarPoint.Web.Spread.Model.IncludeHeaders.ColumnHeadersCustomOnly, false, "#", "%", "^", false, System.Text.Encoding.ASCII, false); 
}
FpSpread1.Sheets(0).RowCount = 6
FpSpread1.Sheets(0).ColumnCount = 6
FpSpread1.Sheets(0).Cells(0, 0, 5, 5).Text = "test"
FpSpread1.Sheets(0).ColumnHeader.Cells(0, 0).Text = "Custom"
FpSpread1.Sheets(0).Cells(0, 0).BackColor = Drawing.Color.CadetBlue

Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click    
    'FpSpread1.Sheets(0).SaveTextFileRange(0, 0, 5, 5, "c:\controls\textfile.txt", True, FarPoint.Web.Spread.Model.IncludeHeaders.None, "#", "%", "^")
    'FpSpread1.Sheets(0).SaveTextFileRange(0, 0, 5, 5, "c:\controls\textfile.txt", False, FarPoint.Web.Spread.Model.IncludeHeaders.ColumnHeadersCustomOnly, False, "#", "%", "^")
    'FpSpread1.Sheets(0).SaveTextFileRange(0, 0, 5, 5, "c:\controls\textfile.txt", True, FarPoint.Web.Spread.Model.IncludeHeaders.None, "#", "%", "^", System.Text.Encoding.ASCII)
    'FpSpread1.Sheets(0).SaveTextFileRange(0, 0, 5, 5, "c:\controls\textfile.txt", True, FarPoint.Web.Spread.Model.IncludeHeaders.None, False, "#", "%", "^", System.Text.Encoding.ASCII)
    'FpSpread1.Sheets(0).SaveTextFileRange(0, 0, 5, 5, "c:\controls\textfile.txt", False, FarPoint.Web.Spread.Model.IncludeHeaders.ColumnHeadersCustomOnly, False, "#", "%", "^", False)
    'FpSpread1.Sheets(0).SaveTextFileRange(0, 0, 5, 5, "c:\controls\textfile.txt", True, FarPoint.Web.Spread.Model.IncludeHeaders.None, "#", "%", "^", False)
    'FpSpread1.Sheets(0).SaveTextFileRange(0, 0, 5, 5, "c:\controls\textfile.txt", False, FarPoint.Web.Spread.Model.IncludeHeaders.ColumnHeadersCustomOnly, False, "#", "%", "^", False, System.Text.Encoding.ASCII)
    'FpSpread1.Sheets(0).SaveTextFileRange(0, 0, 5, 5, "c:\controls\textfile.txt", False, FarPoint.Web.Spread.Model.IncludeHeaders.ColumnHeadersCustomOnly, "#", "%", "^", False, System.Text.Encoding.ASCII)
    'FpSpread1.Sheets(0).SaveTextFileRange(0, 0, 5, 5, "c:\controls\textfile.txt", False, FarPoint.Web.Spread.Model.IncludeHeaders.ColumnHeadersCustomOnly, "#", "%", "^", False, System.Text.Encoding.ASCII, False)
    FpSpread1.Sheets(0).SaveTextFileRange(0, 0, 5, 5, "c:\controls\textfile.txt", False, FarPoint.Web.Spread.Model.IncludeHeaders.ColumnHeadersCustomOnly, False, "#", "%", "^", False, System.Text.Encoding.ASCII, False)   
End Sub
参照

SheetView クラス
SheetView メンバ
オーバーロード一覧

 

 


© 2003-2015, GrapeCity inc. All rights reserved.