You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Cell.Rangerange=newCell.Range(newCell.Address(1,1),newCell.Address(3,3));// Create a cell range for the selection B2:D4
357
358
workbook.CurrentWorksheet.SetSelectedCells(range);// Set the selection to the range
358
-
workbook.AddWorksheet("Sheet2",true);// Create new worksheet with already existing name; The name will be changed to Sheet21 due to auto-sanitizing (appending of 1)
359
+
workbook.AddWorksheet("Sheet2",true);// Create new worksheet with already existing name; The name will be changed to Sheet21 due to auto-sanitizing (appending of 1)
workbook.CurrentWorksheet.SetSelectedCells(newCell.Address(2,2),newCell.Address(4,4));// Set the selection to the range C3:E5
361
362
workbook.SetSelectedWorksheet(1);// Set the second Tab as selected (zero-based: 1)
@@ -451,5 +452,26 @@ private static void Demo10()
451
452
wb.Save();// Save the workbook
452
453
}
453
454
455
+
/// <summary>
456
+
/// This demo shows the usage of the SetStyle methods on worksheets
457
+
/// </summary>
458
+
privatestaticvoidDemo11()
459
+
{
460
+
Workbookwb=newWorkbook("demo11.xlsx","setStyles");// Create a new workbook
461
+
462
+
Stylestyle=newStyle();// Create a new style
463
+
style.Append(Style.BasicStyles.ColorizedBackground("FF0000"));// Append a visible style component
464
+
465
+
wb.CurrentWorksheet.AddCell("Test","C3",Style.BasicStyles.Bold);// Define a cell with a style (will be replaced)
466
+
467
+
wb.CurrentWorksheet.SetStyle("A1",style);// Set style based on a string address
468
+
wb.CurrentWorksheet.SetStyle("A3:B6",style);// Set style based on a string address range
469
+
wb.CurrentWorksheet.SetStyle(newCell.Address(0,7),style);// Set style based on a address object
470
+
wb.CurrentWorksheet.SetStyle(newCell.Range(newCell.Address("C1"),newCell.Address(4,8)),style);// Set style based on a range object (overwrites style on C3)
471
+
wb.CurrentWorksheet.SetStyle(newCell.Address("F6"),newCell.Address("F10"),style);// Set style based on a two address objects as range
<ProjectSummary>&lt%3bp&gt%3bPicoXLSX is a small .NET / C# library to create XLSX files %28Microsoft Excel 2007 or newer%29 in an easy and native way&lt%3b/p&gt%3b
&lt%3bli&gt%3bNo need for an installation of Microsoft Office&lt%3b/li&gt%3b
51
-
&lt%3bli&gt%3bNo need for Office interop libraries&lt%3b/li&gt%3b
52
-
&lt%3bli&gt%3bNo need for 3rd party libraries&lt%3b/li&gt%3b
53
-
&lt%3bli&gt%3bNo need for an installation of the Microsoft Open Office XML SDK %28OOXML%29&lt%3b/li&gt%3b
54
-
&lt%3b/ul&gt%3b
47
+
<ProjectSummary>&lt%3bp&gt%3bPicoXLSX is a small .NET / C# library to create XLSX files %28Microsoft Excel 2007 or newer%29 in an easy and native way&lt%3b/p&gt%3b
48
+
&lt%3bul&gt%3b
49
+
&lt%3bli&gt%3b&lt%3bstrong&gt%3bMinimum of dependencies&lt%3b/strong&gt%3b %28%2a&lt%3b/li&gt%3b
50
+
&lt%3bli&gt%3bNo need for an installation of Microsoft Office&lt%3b/li&gt%3b
51
+
&lt%3bli&gt%3bNo need for Office interop libraries&lt%3b/li&gt%3b
52
+
&lt%3bli&gt%3bNo need for 3rd party libraries&lt%3b/li&gt%3b
53
+
&lt%3bli&gt%3bNo need for an installation of the Microsoft Open Office XML SDK %28OOXML%29&lt%3b/li&gt%3b
54
+
&lt%3b/ul&gt%3b
55
55
&lt%3bp&gt%3bSee the &lt%3bstrong&gt%3b&lt%3ba href=&quot%3bhttps://github.com/rabanti-github/PicoXLSX/blob/master/Changelog.md&quot%3b&gt%3bChange Log&lt%3b/a&gt%3b&lt%3b/strong&gt%3b for recent updates.&lt%3b/p&gt%3b
PicoXLSX was created with .NET version 4.5. Newer versions like 4.6.1 are working and tested. Older versions like 3.5 and 4.0 may also work with minor or no changes. However, this was not tested yet.
59
-
&lt%3bbr/&gt%3b&lt%3bbr/&gt%3b%2a%29The only requirement to compile the library besides .NET is the assembly &lt%3bb&gt%3bWindowsBase&lt%3b/b&gt%3b. This assembly is a &lt%3bb&gt%3bstandard component in all Microsoft Windows systems&lt%3b/b&gt%3b %28except Windows RT systems%29. If your IDE of choice supports referencing assemblies from the Global Assembly Cache %28&lt%3bb&gt%3bGAC&lt%3b/b&gt%3b%29 of Windows, select WindowsBase from there. If you want so select the DLL manually and Microsoft Visual Studio is installed on your system, the DLL can be found most likely under “c:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0\WindowsBase.dll”, according to this &lt%3ba href=&quot%3bhttps://blogs.msdn.com/b/dmahugh/archive/2006/12/14/finding-windowsbase-dll.aspx&quot%3b&gt%3bMSDN Blog entry&lt%3b/a&gt%3b. Otherwise you find it in the GAC, under “c:\Windows\Microsoft.NET\assembly\GAC_MSIL\WindowsBase”
60
-
&lt%3bbr/&gt%3b&lt%3bbr/&gt%3b
61
-
62
-
If you want to compile the documentation project %28folder: Documentation%3b project file: shfbproj%29, you need also the &lt%3bstrong&gt%3b&lt%3ba href=&quot%3bhttps://github.com/EWSoftware/SHFB&quot%3b&gt%3bSandcastle Help File Builder %28SHFB%29&lt%3b/a&gt%3b&lt%3b/strong&gt%3b. It is also freely available. But you don’t need the documentation project to build the PicoXLSX library.
57
+
58
+
PicoXLSX was created with .NET version 4.5. Newer versions like 4.6 are working and tested. Furthermore, .NET Standard 2.0 is supported since v1.6. Older versions of.NET like 3.5 and 4.0 may also work with minor changes. Some functions introduced in .NET 4.5 were used and must be adapted in this case.
59
+
&lt%3bbr/&gt%3b
60
+
&lt%3bh3&gt%3b.NET 4.5 or newer&lt%3b/h3&gt%3b
61
+
%2a%29The only requirement to compile the library besides .NET %28v4.5 or newer%29 is the assembly &lt%3bb&gt%3bWindowsBase&lt%3b/b&gt%3b, as well as &lt%3bb&gt%3bSystem.IO.Compression&lt%3b/b&gt%3b. These assemblies are &lt%3bb&gt%3bstandard components in all Microsoft Windows systems&lt%3b/b&gt%3b %28except Windows RT systems%29. If your IDE of choice supports referencing assemblies from the Global Assembly Cache %28&lt%3bb&gt%3bGAC&lt%3b/b&gt%3b%29 of Windows, select WindowsBase and Compression from there. If you want so select the DLLs manually and Microsoft Visual Studio is installed on your system, the DLL of WindowsBase can be found most likely under “c:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0\WindowsBase.dll”, as well as System.IO.Compression under &quot%3bc:\Program Files %28x86%29\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.IO.Compression.dll&quot%3b. Otherwise you find them in the GAC, under “c:\Windows\Microsoft.NET\assembly\GAC_MSIL\WindowsBase” and &quot%3bc:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.IO.Compression&quot%3b
62
+
&lt%3bbr/&gt%3b
63
+
The NuGet package &lt%3bb&gt%3bdoes not require dependencies&lt%3b/b&gt%3b
.NET Standard v2.0 resolves the dependency System.IO.Compression automatically, using NuGet and does not rely anymore on WindowsBase in the development environment. In contrast to the .NET &amp%3bgt%3b=4.5 version, &lt%3bb&gt%3bno manually added dependencies necessary&lt%3b/b&gt%3b %28as assembly references%29 to compile the library.&lt%3bbr/&gt%3b
68
+
69
+
Please note that the demo project of the .NET Standard version will not work in Visual Studio 2017. To get the build working, unload the demo project of the .NET Standard version.
If you want to compile the documentation project %28folder: Documentation%3b project file: shfbproj%29, you need also the &lt%3bstrong&gt%3b&lt%3ba href=&quot%3bhttps://github.com/EWSoftware/SHFB&quot%3b&gt%3bSandcastle Help File Builder %28SHFB%29&lt%3b/a&gt%3b&lt%3b/strong&gt%3b. It is also freely available. But you don’t need the documentation project to build the PicoXLSX library.&lt%3bbr/&gt%3b
74
+
The .NET version of the documentation may vary, based on the installation. If v4.5 is not available, upgrade to target to a newer version, like v4.6
Simply place the PicoXLSX DLL into your .NET project and add a reference to it. Please keep in mind that the .NET version of your solution must match with the runtime version of the PicoXLSX DLL %28currently compiled with 4.5%29.
Simply place the PicoXLSX DLL into your .NET project and add a reference to it. Please keep in mind that the .NET version of your solution must match with the runtime version of the PicoXLSX DLL %28currently compiled with 4.5 and .NET Standard 2.0%29.
Place all .CS files from the PicoXLSX source folder into your project. You can place them into a sub-folder if you wish. The files contains definitions for workbooks, worksheets, cells, styles, meta-data, low level methods and exceptions.
&lt%3bpre&gt%3b&lt%3bcode&gt%3b Workbook workbook = new Workbook%28&amp%3bquot%3bmyWorkbook.xlsx&amp%3bquot%3b, &amp%3bquot%3bSheet1&amp%3bquot%3b%29%3b // Create new workbook with a worksheet called Sheet1
&lt%3bpre&gt%3b&lt%3bcode&gt%3b Workbook workbook = new Workbook%28&amp%3bquot%3bmyWorkbook.xlsx&amp%3bquot%3b, &amp%3bquot%3bSheet1&amp%3bquot%3b%29%3b // Create new workbook with a worksheet called Sheet1
&lt%3bpre&gt%3b&lt%3bcode&gt%3b Workbook workbook = new Workbook%28&amp%3bquot%3bmyWorkbook.xlsx&amp%3bquot%3b, &amp%3bquot%3bSheet1&amp%3bquot%3b%29%3b // Create new workbook with a worksheet called Sheet1
&lt%3bpre&gt%3b&lt%3bcode&gt%3b Workbook workbook = new Workbook%28&amp%3bquot%3bmyWorkbook.xlsx&amp%3bquot%3b, &amp%3bquot%3bSheet1&amp%3bquot%3b%29%3b // Create new workbook with a worksheet called Sheet1
0 commit comments