-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
executable file
·43 lines (36 loc) · 1.36 KB
/
Program.cs
File metadata and controls
executable file
·43 lines (36 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
namespace xw
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using OfficeOpenXml;
using XbrlTable;
class Program
{
static string rootFolder = Environment.GetEnvironmentVariable("XBRL_ROOT");
static void Main(string[] args)
{
var modulePath = "/home/john/xbrl/eiopa.europa.eu/eu/xbrl/s2md/fws/solvency/solvency2/2016-07-15/mod/adh.xsd";
var workbookPath = Path.ChangeExtension(Path.GetFileName(modulePath), "xlsx");
CreateWorkbookForModule(modulePath, workbookPath);
}
private static void CreateWorkbookForModule(string modulePath, string workbookPath)
{
var tables = Parsing.ParseTables(modulePath);
File.Delete(workbookPath);
var file = new FileInfo(workbookPath);
using (var package = new ExcelPackage(file))
{
foreach (var table in tables)
{
var worksheet = package.Workbook.Worksheets.Add(table.Code);
var endCoordinate = table.WriteToWorksheet(worksheet, new ExcelCoordinate(1, 1));
worksheet.Pretty();
}
package.Save();
}
Console.WriteLine(file.FullName);
}
}
}