From 8ac0a02a8926cc7e014f39fd49429f9639ffd6cb Mon Sep 17 00:00:00 2001 From: xuri Date: Fri, 14 Feb 2025 20:15:20 +0800 Subject: [PATCH] Add a new function SetColStyle for streaming writer in ja version docs - Add a new exported error variable ErrStreamSetColStyle --- en/SUMMARY.md | 14 +++++++------- en/stream.md | 16 ++++++++-------- ja/SUMMARY.md | 1 + ja/stream.md | 12 ++++++++++++ ja/variables.md | 2 ++ 5 files changed, 30 insertions(+), 15 deletions(-) diff --git a/en/SUMMARY.md b/en/SUMMARY.md index 197a7b18..01ce40d7 100644 --- a/en/SUMMARY.md +++ b/en/SUMMARY.md @@ -190,13 +190,13 @@ * [Get default font](style.md#GetDefaultFont) * [Streaming write](stream.md) * [Get stream writer](stream.md#NewStreamWriter) - * [Write sheet row to stream](stream.md#SetRow) - * [Add table to stream](stream.md#AddTable) - * [Insert page break to stream](stream.md#InsertPageBreak) - * [Set panes to stream](stream.md#SetPanes) - * [Merge cell to stream](stream.md#MergeCell) - * [Set column style to stream](stream.md#SetColStyle) - * [Set column width to stream](stream.md#SetColWidth) + * [Write sheet row in stream](stream.md#SetRow) + * [Add table in stream](stream.md#AddTable) + * [Insert page break in stream](stream.md#InsertPageBreak) + * [Set panes in stream](stream.md#SetPanes) + * [Merge cell in stream](stream.md#MergeCell) + * [Set column style in stream](stream.md#SetColStyle) + * [Set column width in stream](stream.md#SetColWidth) * [Flush stream](stream.md#Flush) * [Data](data.md) * [Add data validation](data.md#AddDataValidation) diff --git a/en/stream.md b/en/stream.md index ec9ea789..1c54c099 100644 --- a/en/stream.md +++ b/en/stream.md @@ -117,7 +117,7 @@ err := sw.SetRow("A1", []interface{}{ excelize.Cell{Value: 1}}, excelize.RowOpts{OutlineLevel: 1}) ``` -## Write sheet row to stream {#SetRow} +## Write sheet row in stream {#SetRow} ```go func (sw *StreamWriter) SetRow(cell string, values []interface{}, opts ...RowOpts) error @@ -125,7 +125,7 @@ func (sw *StreamWriter) SetRow(cell string, values []interface{}, opts ...RowOpt SetRow writes an array to stream rows by giving starting cell reference and a pointer to an array of values. Note that you must call the [`Flush`](stream.md#Flush) function to end the streaming writing process. -## Add table to stream {#AddTable} +## Add table in stream {#AddTable} ```go func (sw *StreamWriter) AddTable(table *Table) error @@ -156,7 +156,7 @@ err := sw.AddTable(&excelize.Table{ Note that the table must be at least two lines including the header. The header cells must contain strings and must be unique. Currently only one table is allowed for a `StreamWriter`. [`AddTable`](stream.md#AddTable) must be called after the rows are written but before `Flush`. See [`AddTable`](utils.md#AddTable) for details on the table format. -## Insert page break to stream {#InsertPageBreak} +## Insert page break in stream {#InsertPageBreak} ```go func (sw *StreamWriter) InsertPageBreak(cell string) error @@ -164,7 +164,7 @@ func (sw *StreamWriter) InsertPageBreak(cell string) error InsertPageBreak creates a page break to determine where the printed page ends and where begins the next one by a given cell reference, the content before the page break will be printed on one page and after the page break on another. -## Set panes to stream {#SetPanes} +## Set panes in stream {#SetPanes} ```go func (sw *StreamWriter) SetPanes(panes *Panes) error @@ -172,7 +172,7 @@ func (sw *StreamWriter) SetPanes(panes *Panes) error SetPanes provides a function to create and remove freeze panes and split panes by giving panes options for the `StreamWriter`. Note that you must call the `SetPanes` function before the [`SetRow`](stream.md#SetRow) function. -## Merge cell to stream {#MergeCell} +## Merge cell in stream {#MergeCell} ```go func (sw *StreamWriter) MergeCell(topLeftCell, bottomRightCell string) error @@ -180,19 +180,19 @@ func (sw *StreamWriter) MergeCell(topLeftCell, bottomRightCell string) error MergeCell provides a function to merge cells by a given range reference for the `StreamWriter`. Don't create a merged cell that overlaps with another existing merged cell. -## Set column style to stream {#SetColStyle} +## Set column style in stream {#SetColStyle} ```go func (sw *StreamWriter) SetColStyle(minVal, maxVal, styleID int) error ``` -SetColStyle provides a function to set the style of a single column or multiple columns for the `StreamWriter`. Note that you must call the `SetColStyle` function before the [`SetRow`](stream.md#SetRow) function. For example set style of column `H`: +SetColStyle provides a function to set the style of a single column or multiple columns for the `StreamWriter`. Note that you must call the `SetColStyle` function before the [`SetRow`](stream.md#SetRow) function. For example set style of column `H`: ```go err := sw.SetColStyle(8, 8, style) ``` -## Set column width to stream {#SetColWidth} +## Set column width in stream {#SetColWidth} ```go func (sw *StreamWriter) SetColWidth(min, max int, width float64) error diff --git a/ja/SUMMARY.md b/ja/SUMMARY.md index d36c6e08..6f822667 100644 --- a/ja/SUMMARY.md +++ b/ja/SUMMARY.md @@ -195,6 +195,7 @@ * [ストリームに改ページを挿入](stream.md#InsertPageBreak) * [ストリームによるペインの設定](stream.md#SetPanes) * [ストリームでマージセル](stream.md#MergeCell) + * [ストリームの列スタイルを設定する](stream.md#SetColStyle) * [ストリームの列幅を設定する](stream.md#SetColWidth) * [エンディングストリーム](stream.md#Flush) * [データ](data.md) diff --git a/ja/stream.md b/ja/stream.md index bc0cee07..7f5b6a2d 100644 --- a/ja/stream.md +++ b/ja/stream.md @@ -180,6 +180,18 @@ func (sw *StreamWriter) MergeCell(topLeftCell, bottomRightCell string) error 指定されたセル座標範囲を使用してセルをストリーミングすると、現在、重なり合うセル以外のセルの結合のみがサポートされます。 +## ストリームの列スタイルを設定する {#SetColStyle} + +```go +func (sw *StreamWriter) SetColStyle(minVal, maxVal, styleID int) error +``` + +SetColStyle は、`StreamWriter` の単一列または複数列のスタイルを設定する関数を提供します。[`SetRow`](stream.md#SetRow) 関数の前に `SetColStyle` 関数を呼び出す必要があることに注意してください。たとえば、列 `H` のスタイルを設定するには、次のようにします。 + +```go +err := sw.SetColStyle(8, 8, style) +``` + ## ストリームの列幅を設定する {#SetColWidth} ```go diff --git a/ja/variables.md b/ja/variables.md index 39e7c30c..20e70c54 100644 --- a/ja/variables.md +++ b/ja/variables.md @@ -86,6 +86,8 @@ var ( ErrSparklineStyle = errors.New("parameter 'Style' must between 0-35") // ErrSparklineType は、無効なスパークラインの Type パラメーターを受信したときのエラーメッセージを定義しました ErrSparklineType = errors.New("parameter 'Type' must be 'line', 'column' or 'win_loss'") + // ErrStreamSetColStyle は、ストリーム書き込みモードでの列スタイル設定に関するエラー メッセージを定義します + ErrStreamSetColStyle = errors.New("must call the SetColStyle function before the SetRow function") // ErrStreamSetColWidth は、ストリーム書き込みモードでの列幅の設定に関するエラーメッセージを定義しました ErrStreamSetColWidth = errors.New("must call the SetColWidth function before the SetRow function") // ErrStreamSetPanes は、ストリーム書き込みモードのセット ペインでのエラー メッセージを定義しました