Solution.Framework.Office
7.0.2
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package Solution.Framework.Office --version 7.0.2
NuGet\Install-Package Solution.Framework.Office -Version 7.0.2
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Solution.Framework.Office" Version="7.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Solution.Framework.Office --version 7.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Solution.Framework.Office, 7.0.2"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Solution.Framework.Office as a Cake Addin #addin nuget:?package=Solution.Framework.Office&version=7.0.2 // Install Solution.Framework.Office as a Cake Tool #tool nuget:?package=Solution.Framework.Office&version=7.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Office
Office Framework
Sample code
ExcelClass
using Solution.Framework.Office;
using System;
using System.Data;
using System.IO;
namespace ConsoleApp.FrameworkOffice
{
class Program
{
static void Main(string[] args)
{
string filePath = @"C:\Temp\Test.xlsx";
DataSet ds = GetDataSet();
// 1
ExcelClass.Export(filePath, ds);
// 2
byte[] xlsx = ExcelClass.Export(ds);
}
private DataSet GetDataSet()
{
DataSet ds = new();
DataTable dt = new("Table1");
for (int i = 0; i <= 100; i++)
{
dt.Columns.Add(new DataColumn($"Header.{i}"));
}
for (int i = 1; i <= 100; i++)
{
DataRow dr = dt.NewRow();
for (int c = 0; c <= 100; c++)
{
dr[$"Header.{c}"] = $"Col{c}." + i.ToString();
}
dt.Rows.Add(dr);
}
ds.Tables.Add(dt);
dt = new DataTable("Table2");
for (int i = 0; i <= 100; i++)
{
dt.Columns.Add(new DataColumn($"Header.{i}"));
}
for (int i = 1; i <= 100; i++)
{
DataRow dr = dt.NewRow();
for (int c = 0; c <= 100; c++)
{
dr[$"Header.{c}"] = $"Col{c}." + i.ToString();
}
dt.Rows.Add(dr);
}
ds.Tables.Add(dt);
return ds;
}
}
}
OutlookClass
{
"EmailConfigurations": {
"SmtpServer": "smtp",
"SmtpPort": 587,
"SmtpUser": "email",
"SmtpPassword": "password",
"EnableSsl": true,
"UseDefaultCredentials": false,
"Timeout": 60,
"ToTest": "",
"CCTest": "",
"CCOTest": "",
"SubjectTest": "",
"BodyTest": ""
}
}
using Microsoft.Extensions.Configuration;
using Solution.Framework.Office.Helpers;
using Solution.Framework.Office.Models;
using Solution.Framework.Office.Test.Classes;
using System.Collections.Generic;
namespace ConsoleApp.FrameworkOffice
{
class Program
{
static void Main(string[] args)
{
OutlookClass.Configuration = GetConfiguration();
// 1
OutlookClass.Send("email", "Email Test", "Test");
// 2
OutlookClass.Send("email", "Email Test", GetBody());
}
private static IConfiguration GetConfiguration()
{
string path = "appsettings.json";
if (File.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json"))
{
path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json";
}
return new ConfigurationBuilder().AddJsonFile(path).Build();
}
private Dictionary<string, EmailParameter[]> GetBody()
{
Dictionary<string, EmailParameter[]> pairs = new();
ElementTable[] sourceData = new[]
{
new ElementTable { Nome = "Name1", Valor = 100.30M },
new ElementTable { Nome = "Name2", Valor = 300.56M },
new ElementTable { Nome = "Name3", Valor = 140.30M }
};
string html = sourceData.ToHtmlTable();
EmailParameter[] parameters = new[]
{
new EmailParameter { Name = "Parameter1", Value = "Test Parameter"},
new EmailParameter { Name = "Parameter2", Value = "Office"},
new EmailParameter { Name = "tables", Value = html }
};
pairs.Add(@"<h2>E-mail Test {{Parameter1}}</h2>
<p> </p>
<p>This email is a test for framework {{Parameter2}}</p>
{{tables}}", parameters);
return pairs;
}
}
}
SftpClass
{
"SftpConfigurations": {
"Host": "host",
"Port": 123,
"UserName": "user name",
"Password": "password"
}
}
using Solution.Framework.Office;
using System;
using System.Data;
using System.IO;
namespace ConsoleApp.FrameworkOffice
{
class Program
{
static void Main(string[] args)
{
List<SftpResponse> result = StfpClass.SendFile(GetConfiguration(), "fileName", "sourcePath", "destinationPath", "privateKeyFile")
List<SftpResponse> result = StfpClass.ReceiveFile(GetConfiguration(), "fileName", "sourcePath", "destinationPath", "privateKeyFile")
}
private static IConfiguration GetConfiguration()
{
string path = "appsettings.json";
if (File.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json"))
{
path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json";
}
return new ConfigurationBuilder().AddJsonFile(path).Build();
}
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net7.0
- DocumentFormat.OpenXml (>= 2.20.0)
- Microsoft.Extensions.Configuration (>= 7.0.0)
- Microsoft.Extensions.Configuration.Binder (>= 7.0.4)
- SSH.NET (>= 2020.0.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.