DD.WellWorkover.Cloud/ConsoleApp1/Program.cs

60 lines
2.0 KiB
C#
Raw Normal View History

using AsbCloudApp.Data;
using AsbCloudDb.Model;
using AsbCloudInfrastructure.Services;
using AsbCloudInfrastructure.Services.Cache;
2021-08-29 17:25:16 +05:00
using DocumentFormat.OpenXml;
using DocumentFormat.OpenXml.Packaging;
using DocumentFormat.OpenXml.Spreadsheet;
//using AsbSaubReport;
//using AutoMapper;
using Microsoft.EntityFrameworkCore;
using System;
namespace ConsoleApp1
{
class Program
{
2021-07-28 09:47:13 +05:00
static void Main(/*string[] args*/)
{
2021-07-28 09:47:13 +05:00
2021-08-29 17:25:16 +05:00
//var options = new DbContextOptionsBuilder<AsbCloudDbContext>()
// .UseNpgsql("Host=localhost;Database=postgres;Username=postgres;Password=q;Persist Security Info=True")
// .Options;
//var context = new AsbCloudDbContext(options);
var fileNames = new string[] { @"d:\temp\1\book1.xlsx", @"d:\temp\1\book2.xlsx" };
using var spreadsheetDocument = SpreadsheetDocument.Create(@"d:\temp\1\b.xlsx", SpreadsheetDocumentType.Workbook);
// Add a WorkbookPart and Workbook objects.
WorkbookPart workbookpart = spreadsheetDocument.AddWorkbookPart();
workbookpart.Workbook = new Workbook();
// Add a WorksheetPart to the WorkbookPart.
WorksheetPart worksheetPart = workbookpart.AddNewPart<WorksheetPart>();
worksheetPart.Worksheet = new Worksheet(new SheetData());
// Add Sheets to the Workbook.
Sheets sheets = spreadsheetDocument.WorkbookPart.Workbook.
AppendChild<Sheets>(new Sheets());
// Append a new worksheet and associate it with the workbook.
Sheet sheet = new Sheet()
{
Id = spreadsheetDocument.WorkbookPart.
GetIdOfPart(worksheetPart),
SheetId = 1,
Name = "mySheetNameISHere!"
};
sheets.Append(sheet);
spreadsheetDocument.Save();
spreadsheetDocument.Close();
2021-04-23 10:21:25 +05:00
2021-04-08 17:54:02 +05:00
Console.WriteLine("Done. Press any key to quit.");
Console.ReadKey();
}
2021-04-07 18:01:56 +05:00
}
}