Skip to content

FLUT-6883 - UG documentation for moving worksheets using flutter XlsIO - Development #374

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 19, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions Flutter/xlsio/working-with-excel-worksheet.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,32 @@ File('Output.xlsx').writeAsBytes(bytes);

{% endhighlight %}

## Move a Worksheet

XlsIO allows moving worksheets from one position to another by using the *moveTo* method. The following code example illustrates this.

{% highlight dart %}
//Create a new Excel Document.
final Workbook workbook = Workbook(20);

//Access worksheets
final Worksheet sheet = workbook.worksheets[10];
final Worksheet sheet1 = workbook.worksheets[3];

sheet.getRangeByName('A1:B10').text = 'Moving Sheet';
sheet1.getRangeByName('A1:B20').dateTime = DateTime(2006, 9, 10);
sheet.hyperlinks.add(sheet.getRangeByName('C1:C5'), HyperlinkType.url, 'http://www.gmail.com');

//Move worksheet
workbook.worksheets.moveTo(workbook.worksheets[10], 5);
workbook.worksheets.moveTo(workbook.worksheets[3], 15);

//save and dispose.
final List<int> bytes = workbook.saveAsStream();
File('Output.xlsx').writeAsBytes(bytes);
workbook.dispose();
{% endhighlight %}

## Right to Left Direction

A *worksheet* direction can be changed from right to left programmatically through **isRightToLeft** property of **Worksheet**. The following code snippet explains this.
Expand Down