Skip to content

Commit 6d672bb

Browse files
authored
Merge pull request #158 from syncfusion-content/FLUT-6317-HideRowsAndColumns-Dev
FLUT-6317-[documentation][flutter]: Hide Rows And Columns - XlsIO
2 parents 2cde3de + 66e3728 commit 6d672bb

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

Flutter/xlsio/worksheet-rows-and-columns-manipulation.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,53 @@ workbook.dispose();
183183

184184
{% endhighlight %}
185185

186+
## Show or Hide Rows and Columns
186187

188+
Visibility of rows and columns can be set by using the [showRows](https://pub.dev/documentation/syncfusion_flutter_xlsio/latest/xlsio/Range/showRows.html) and [showColumns](https://pub.dev/documentation/syncfusion_flutter_xlsio/latest/xlsio/Range/showColumns.html) methods as shown below.
187189

190+
{% highlight dart %}
191+
192+
// Create a new Excel Document.
193+
final Workbook workbook = Workbook(1);
194+
195+
// Accessing sheet via index.
196+
final Worksheet sheet = workbook.worksheets[0];
197+
198+
// Show or hide rows in the given range. TRUE by default.
199+
sheet.getRangeByName('A1').showRows(false);
200+
sheet.getRangeByName('A2:A5').showRows(false);
201+
202+
// Show or hide columns in the given range. TRUE by default.
203+
sheet.getRangeByName('C10').showColumns(false);
204+
sheet.getRangeByName('D10:E10').showColumns(false);
205+
206+
// Save and dispose workbook.
207+
final List<int>? bytes = workbook.saveAsStream();
208+
File('HideRowsAndColumns.xlsx').writeAsBytes(bytes!);
209+
workbook.dispose();
210+
211+
{% endhighlight %}
212+
213+
## Show or Hide Specific Range
214+
215+
The following code snippet shows how to set the visibility for a specific range through [showRange](https://pub.dev/documentation/syncfusion_flutter_xlsio/latest/xlsio/Range/showRange.html) method .
216+
217+
{% highlight dart %}
218+
219+
// Create a new Excel Document.
220+
final Workbook workbook = Workbook(1);
221+
222+
// Accessing sheet via index.
223+
final Worksheet sheet = workbook.worksheets[0];
224+
225+
// Show or hide rows and columns in the given range. TRUE by default.
226+
sheet.getRangeByName('G15').showRange(false);
227+
sheet.getRangeByName('J22:J25').showRange(false);
228+
229+
// Save and dispose workbook.
230+
final List<int>? bytes = workbook.saveAsStream();
231+
File('HideRowsAndColumns.xlsx').writeAsBytes(bytes!);
232+
workbook.dispose();
233+
234+
{% endhighlight %}
188235

0 commit comments

Comments
 (0)