Skip to content

Commit

Permalink
S5ProtoSheet example
Browse files Browse the repository at this point in the history
  • Loading branch information
zhenyagusev committed Dec 16, 2019
1 parent 795ec40 commit 2f5aa7b
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 0 deletions.
7 changes: 7 additions & 0 deletions README-ru.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,10 @@ Head().AutoSpan().ToSheet().ToBook().ToBytes()

[![s-3-calendar][]][s3calendar.cs]

### [S5ProtoSheet.cs][s5protosheet.cs]

Это демонстрация добавления в книгу листов из существующих книг. См. также [Прототипирование](#прототипирование).

## Концепции

### Описание модели
Expand Down Expand Up @@ -280,6 +284,8 @@ Make.Sheet("New Sheet Name", protoBook, "Prototype Sheet Name");

Из xlsx-файла `protoBook` будет скопирован лист `"Prototype Sheet Name"` и переименован в `"New Sheet Name"`. См. также другие перегрузки `Make.Sheet`.

См. также пример [S5ProtoSheet.cs][s5protosheet.cs].

## Справочник API

- `Make` - фабрика элементов модели
Expand Down Expand Up @@ -434,4 +440,5 @@ Copyright (c) 2019 Zhenya Gusev
[s1table.cs]: src/BookFx.Usage/S1Table.cs
[s2style.cs]: src/BookFx.Usage/S2Style.cs
[s3calendar.cs]: src/BookFx.Usage/S3Calendar.cs
[s5protosheet.cs]: src/BookFx.Usage/S5ProtoSheet.cs
[s-3-calendar]: docs/img/s-3-calendar-ru.png "Результат S3Calendar.cs"
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,10 @@ Wow! Calendar!

[![s-3-calendar][]][s3calendar.cs]

### [S5ProtoSheet.cs][s5protosheet.cs]

This demonstrates an adding worksheets from preexisting workbooks. See also [Prototyping](#prototyping).

## Concepts

### Model Description
Expand Down Expand Up @@ -282,6 +286,8 @@ Make.Sheet("New Sheet Name", protoBook, "Prototype Sheet Name");

`"Prototype Sheet Name"` spreadsheet will be copied from `protoBook` xlsx-file and then it will be renamed to `"New Sheet Name"`. See also other overloads of `Make.Sheet`.

See also the example [S5ProtoSheet.cs][s5protosheet.cs].

## API Reference

- `Make` - the model elements factory
Expand Down Expand Up @@ -434,4 +440,5 @@ along with this library. If not, see <https://www.gnu.org/licenses/>.
[s1table.cs]: src/BookFx.Usage/S1Table.cs
[s2style.cs]: src/BookFx.Usage/S2Style.cs
[s3calendar.cs]: src/BookFx.Usage/S3Calendar.cs
[s5protosheet.cs]: src/BookFx.Usage/S5ProtoSheet.cs
[s-3-calendar]: docs/img/s-3-calendar-en.png "S3Calendar.cs result"
1 change: 1 addition & 0 deletions src/BookFx.Usage/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public static void Main()
ResultStore.Save(S2Style.Create(), $"{nameof(S2Style)}.xlsx");
ResultStore.Save(S3Calendar.Create(DateTime.Now.AddMonths(2).Year), $"{nameof(S3Calendar)}.xlsx");
ResultStore.Save(S4BigTable.Create(), $"{nameof(S4BigTable)}.xlsx");
ResultStore.Save(S5ProtoSheet.Create(), $"{nameof(S5ProtoSheet)}.xlsx");
}
}
}
21 changes: 21 additions & 0 deletions src/BookFx.Usage/S5ProtoSheet.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
namespace BookFx.Usage
{
using System;

public static class S5ProtoSheet
{
public static byte[] Create()
{
byte[] preexistingCalendarBookBytes = S3Calendar.Create(DateTime.Now.AddMonths(2).Year);
byte[] preexistingStyleBookBytes = S2Style.Create();

return Make
.Book()
.Add(Make.Sheet(preexistingCalendarBookBytes, "en").Name("First Sheet"))
.Add(Make.Sheet(preexistingCalendarBookBytes, "ru").Name("Second Sheet"))
.Add(Make.Sheet(preexistingStyleBookBytes).Name("Third Sheet"))
.Add(Make.Value("I am a regular sheet.").ToSheet().Name("Fourth Sheet"))
.ToBytes();
}
}
}

0 comments on commit 2f5aa7b

Please sign in to comment.