Skip to content

Commit bd072f5

Browse files
author
Fahad Adeel
committed
README.md file added
1 parent f3e4e32 commit bd072f5

File tree

7 files changed

+112
-33
lines changed

7 files changed

+112
-33
lines changed

.DS_Store

0 Bytes
Binary file not shown.

FileFormat.Cells/Cell.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public void setNumberDataType()
4949
/// <summary>
5050
/// This method is used to set the value of a Cell.
5151
/// </summary>
52-
/// /// <param name="value">A dynamic value.</param>
52+
/// <param name="value">A dynamic value.</param>
5353
public void CellValue(dynamic value)
5454
{
5555
this.cell.CellValue = new DocumentFormat.OpenXml.Spreadsheet.CellValue(value);
@@ -58,7 +58,6 @@ public void CellValue(dynamic value)
5858
/// <summary>
5959
/// Sets the style index of the cell to 1.
6060
/// </summary>
61-
///
6261
public void CellIndex()
6362
{
6463
this.cell.StyleIndex = 1;
@@ -67,7 +66,7 @@ public void CellIndex()
6766
/// <summary>
6867
/// Sets the style index of the cell to the specified value.
6968
/// </summary>
70-
/// <param name="num">The style index to be set for the cell.</param>
69+
/// <param name="num">The style index is to be set for the cell.</param>
7170

7271
public void CellIndex(UInt32Value num)
7372
{

FileFormat.Cells/Image.cs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using DocumentFormat.OpenXml;
1+
using DocumentFormat.OpenXml;
22
using DocumentFormat.OpenXml.Packaging;
33

44
using A = DocumentFormat.OpenXml.Drawing;
@@ -10,7 +10,7 @@
1010
namespace FileFormat.Cells.Image
1111
{
1212
/// <summary>
13-
/// This class contains methods to add images into an Excel document.
13+
/// This class contains methods to add images to an Excel document.
1414
/// </summary>
1515
public class Image
1616
{
@@ -47,9 +47,10 @@ public Image(Workbook workbook)
4747
/// </summary>
4848
/// <param name="sheetIndex">An integer value represents the index of worksheet.</param>
4949
/// <param name="imagePath">An integer value represents the index of worksheet.</param>
50-
/// <param name="startRowIndex">An integer value.</param>
51-
/// <param name="endRowIndex">An integer value.</param>
52-
/// <param name="endColumnIndex">An integer value</param>
50+
/// <param name="startRowIndex">An integer value that represents the starting row index.</param>
51+
/// <param name="startColumnIndex">An integer value that represents the starting column index.</param>
52+
/// <param name="endRowIndex">An integer value that represents the ending row index.</param>
53+
/// <param name="endColumnIndex">An integer value that represents the ending column index.</param>
5354

5455
public void Add(int sheetIndex, string imagePath, int startRowIndex, int startColumnIndex, int endRowIndex, int endColumnIndex) {
5556

@@ -401,7 +402,7 @@ private void GenerateDrawingsPart(int sheetIndex, DrawingsPart drawingsPart1, in
401402
/// Invoke this method to read the value of a particular cell.
402403
/// </summary>
403404
/// <param name="sheetIndex">An Integer value.</param>
404-
405+
/// <returns>A collection of image streams.</returns>
405406
public List<Stream> ExtractImagesFromWorkSheet(int sheetIndex)
406407
{
407408
List<Stream> imagePartsCollection = new List<Stream>();
@@ -417,7 +418,7 @@ public List<Stream> ExtractImagesFromWorkSheet(int sheetIndex)
417418
/// <summary>
418419
/// Call this property to get the total number of images in a Workbook.
419420
/// </summary>
420-
421+
/// <returns>The count of the total number of images in a Workbook. </returns>
421422
public int GetImagesCountFromWorkBook
422423
{
423424
get

FileFormat.Cells/Properties.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ public class BuiltInDocumentProperties
88
{
99

1010
/// <summary>
11-
/// This property is used to get/set the Author name of a Word document.
11+
/// This property is used to get/set the Author name of an Excel document.
1212
/// </summary>
1313
/// <returns>Returns a string value.</returns>
1414
public String Author { get; set; }

FileFormat.Cells/Workbook.cs

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.IO.Packaging;
33
using DocumentFormat.OpenXml;
44
using DocumentFormat.OpenXml.Packaging;
@@ -18,16 +18,18 @@ public class Workbook : IDisposable
1818
protected internal DocumentFormat.OpenXml.Packaging.SpreadsheetDocument spreadsheetDocument;
1919
/// <value>
2020
/// An object of the Parent WorkbookPart class.
21-
/// </value>
21+
/// </value>
2222
protected internal DocumentFormat.OpenXml.Packaging.WorkbookPart workbookpart;
2323
/// <value>
2424
/// An object of the Parent worksheetPart class.
25-
/// </value>
26-
protected internal DocumentFormat.OpenXml.Packaging.WorksheetPart worksheetPart;
27-
28-
protected internal WorkbookStylesPart stylesPart;
29-
30-
private MemoryStream ms;
25+
/// </value>
26+
protected internal DocumentFormat.OpenXml.Packaging.WorksheetPart worksheetPart;
27+
/// <value>
28+
/// An object of the Parent WorkbookStylesPart class.
29+
/// </value>
30+
protected internal WorkbookStylesPart stylesPart;
31+
32+
private MemoryStream ms;
3133
private bool disposedValue;
3234

3335
/// <summary>
@@ -44,7 +46,7 @@ public Workbook()
4446
this.worksheetPart = this.workbookpart.AddNewPart<WorksheetPart>();
4547
this.worksheetPart.Worksheet = new DocumentFormat.OpenXml.Spreadsheet.Worksheet();
4648

47-
this.stylesPart = this.spreadsheetDocument.WorkbookPart.AddNewPart<WorkbookStylesPart>();
49+
this.stylesPart = this.spreadsheetDocument.WorkbookPart.AddNewPart<WorkbookStylesPart>();
4850
this.stylesPart.Stylesheet = new Stylesheet();
4951

5052

@@ -55,10 +57,10 @@ public Workbook()
5557

5658
}
5759

58-
// <summary>
60+
/// <summary>
5961
/// Applies the specified font style to the workbook.
6062
/// </summary>
61-
/// <param name="fontName">The name of the font to be applied.</param>
63+
/// <param name='fontName'>The name of the font to be applied.</param>
6264
/// <param name="fontSize">The size of the font to be applied.</param>
6365

6466
public void ApplyFontStyle(string fontName, int fontSize)
@@ -79,12 +81,10 @@ public void ApplyFontStyle(string fontName, int fontSize)
7981
// Add the font to the Fonts collection in the Stylesheet
8082
stylesPart.Stylesheet.Fonts = new Fonts();
8183
stylesPart.Stylesheet.Fonts.AppendChild(font);
82-
8384

8485
}
8586

8687

87-
8888
/// <summary>
8989
/// Create an object of the Workbook class that opens an existing Excel document from a file.
9090
/// </summary>
@@ -146,7 +146,7 @@ public void Save(string filePath)
146146
}
147147

148148
/// <summary>
149-
/// Invoke this method to save the document to a file.
149+
/// Invoke this method to save the document to a stream.
150150
/// </summary>
151151
/// <param name="stream">An object of the Stream class.</param>
152152
public void Save(Stream stream)
@@ -174,6 +174,7 @@ public int Worksheets
174174
/// Invoke this method to delete a worksheet from an Excel document.
175175
/// </summary>
176176
/// <param name="sheetName">String value represents the worksheet name.</param>
177+
/// <returns>A string value. </returns>
177178
public string DeleteWorksheet(string sheetName)
178179
{
179180
try
@@ -214,6 +215,7 @@ public string DeleteWorksheet(string sheetName)
214215
/// </summary>
215216
/// <param name="sheetName">String value represents the worksheet name.</param>
216217
/// <param name="cellRef">String value represents the address of the cell.</param>
218+
/// <returns>A sttring value. </returns>
217219
public string GetCellValue(string sheetName, string cellRef)
218220
{
219221

@@ -236,7 +238,7 @@ public string GetCellValue(string sheetName, string cellRef)
236238
/// This method removes a cell's value in a Worksheet.
237239
/// </summary>
238240
/// <param name="sheetName">String value represents the worksheet name.</param>
239-
/// <param name="colName">String value represents the name of the column.</param>
241+
/// <param name="colName">The string value represents the name of the column.</param>
240242
/// <param name="rowIndex">An integer value represents the row.</param>
241243
public void DeleteTextFromCell(string sheetName, string colName, uint rowIndex)
242244
{
@@ -284,6 +286,7 @@ private DocumentFormat.OpenXml.Spreadsheet.Cell GetSpreadsheetCell(DocumentForma
284286
/// <summary>
285287
/// It returns custom built-in document properties.
286288
/// </summary>
289+
/// <returns>An object of document properties. </returns>
287290
public BuiltInDocumentProperties BuiltinDocumentProperties
288291
{
289292
get

FileFormat.Cells/Worksheet.cs

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
using System.Linq;
1+
using System.Linq;
22
using System.Text.RegularExpressions;
3-
using DocumentFormat.OpenXml;
3+
using DocumentFormat.OpenXml;
44
using DocumentFormat.OpenXml.Packaging;
55
using DocumentFormat.OpenXml.Spreadsheet;
66

@@ -34,10 +34,17 @@ public class Worksheet
3434
private UInt32 sheetID;
3535
private string ID;
3636
SheetData sheetData;
37+
/// <value>
38+
/// An object of the Parent WorkbookStylesPart class.
39+
/// </value>
3740
protected internal WorkbookStylesPart stylesPart;
38-
41+
/// <value>
42+
/// An object of the Parent MergeCells class.
43+
/// </value>
3944
protected internal MergeCells mergeCells;
40-
45+
/// <value>
46+
/// An object of the Parent Stylesheet class.
47+
/// </value>
4148
protected internal Stylesheet stylesheet;
4249
int i = 1;
4350

@@ -210,9 +217,9 @@ private static List<UInt32> AddStyle(ref Stylesheet stylesheet)
210217
}
211218

212219
/// <summary>
213-
/// Inserts a new cell style into the spreadsheet's styles part.
220+
/// Insert a new cell style into the spreadsheet's styles part.
214221
/// </summary>
215-
/// <param name="cellStyle">The <see cref="CellStyle"/> containing the desired font family, size, and cell color.</param>
222+
/// <param name="cellStyle">The <see cref="CellStyle"/> contains the desired font family, size, and cell color.</param>
216223
/// <returns>The index of the inserted style within the stylesheet's cell formats.</returns>
217224

218225

@@ -294,7 +301,12 @@ private static uint GetRowIndex(string cellName)
294301
}
295302

296303

297-
// Merge two cells by range (e.g., "A1" to "B2")
304+
305+
/// <summary>
306+
/// Merge two cells by range (e.g., "A1" to "B2")
307+
/// </summary>
308+
/// <param name="startCellRef">A string value.</param>
309+
/// <param name="endCellRef">A string value.</param>
298310
public void MergeCells(string startCellRef, string endCellRef)
299311
{
300312

README.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Open-Source .NET API For Excel Automation
2+
3+
<p> <a href="https://fileformat-cells.github.io/FileFormat.Cells-for-.NET/">FileFormat.Cells</a> is an <b>open-source .NET library</b> developed to automate Spreadsheet creation and management. This is an extensible C# library for Workbook management and modification. Regardless of the user's expertise, this <b>Spreadsheet API</b> is easy to install and use. In addition, the robustness of this API is due to <a href="https://learn.microsoft.com/en-us/office/open-xml/word-processing">OpenXML</a> which is the core engine of FileFormat.Cells. However, you may install this C# library to achieve Excel file generation and manipulation programmatically. Once this library is set up, you need no third-party library to automate Spreadsheet creation or modification.
4+
</p>
5+
<p align="center" dir="auto">
6+
<a title="Download ZIP" href="https://github.com/fileformat-cells/FileFormat.Cells-for-.NET/archive/master.zip">
7+
<img src="https://camo.githubusercontent.com/594ea6cc6161dd6c3f7bc55c9022c27b94fe39c74bc90a9a8d144c77b9af1573/687474703a2f2f692e696d6775722e636f6d2f68774e6872475a2e706e67" data-canonical-src="http://i.imgur.com/hwNhrGZ.png" style="max-width: 100%;">
8+
</a>
9+
</p>
10+
11+
## About this Repo
12+
13+
<table>
14+
<tr>
15+
<th>Directory</th>
16+
<th>Description</th>
17+
</tr>
18+
<tr>
19+
<td><a href = "https://github.com/fileformat-cells/FileFormat.Cells-for-.NET/tree/main/FileFormat.Cells_Tests">FileFormat.Cells_Tests</a></td>
20+
<td>This directory contains the unit tests of all the features FileFormat.Cells offers.</td>
21+
</tr>
22+
<tr>
23+
<td><a href = "https://github.com/fileformat-cells/FileFormat.Cells-for-.NET/tree/main/FileFormat.Cells">FileFormat.Cells</a></td>
24+
<td>It contains all the source code files necessary to execute the features.</td>
25+
</tr>
26+
<tr>
27+
<td><a href = "https://github.com/fileformat-cells/FileFormat.Cells-for-.NET/tree/main/TestSpreadSheets">TestSpreadSheets</a></td>
28+
<td>This folder includes test files generated by this Open-Souorce .NET API.</td>
29+
</tr>
30+
</table>
31+
32+
## Library Features & Provisions
33+
34+
<p> <a href="https://fileformat-cells.github.io/FileFormat.Cells-for-.NET/">FileFormat.Cells</a> provides seamless Spreadsheet creation and manipulation. Moreover, this Spreadsheet API lets users design Excel files programmatically as per data representation needs. </p>
35+
36+
This Open-Source .NET API comes up with the following functionalities:
37+
38+
- <a href="https://fileformat-cells.github.io/FileFormat.Cells-for-.NET/">FileFormat.Cells</a> API provides empty Excel file creation as well as with the content. Moreover, .NET developers can
39+
open existing Excel files from a file & stream both.
40+
- This .NET Spreadsheet API offers methods and properties to create/delete Worksheets. Further, users can insert/delete data into cells and read rows/columns programmatically.
41+
- There are methods and properties to update the Font family and Font size of the data in Cells.
42+
- Users can leverage the <a href="https://fileformat-cells.github.io/FileFormat.Cells-for-.NET/api/FileFormat.Cells.Image.Image.html">Image</a> namespace to add images to Worksheets. In addition, there are properties and functions to extract images from Worksheets.
43+
44+
45+
## Getting Started With FileFormat.Words For .NET
46+
47+
<p>Since FileFormat.Cells is available as a <a href="#">NuGet Package</a>, you can download the Nuget Package of this library. Well, the installation procedure of this C# Spreadsheet API is a matter of running a single command as mentioned below: </p>
48+
<code>Install-Package FileFormat.Cells</code>
49+
50+
## Creating a Word Document Programmatically
51+
52+
The following code segment creates an empty <a href="https://docs.fileformat.com/spreadsheet/xlsx/">Excel<a/> file with a default Worksheet.
53+
<pre>
54+
<code>
55+
// Create an object of the Workbook class.
56+
Workbook workbook = new Workbook();
57+
58+
// Call the Save method to save the Excel file onto the disk.
59+
workbook.Save("/spreadsheet.xlsx");
60+
</code>
61+
</pre>
62+
63+
## Coming updates
64+
<p> <a href="https://fileformat-cells.github.io/FileFormat.Cells-for-.NET/">FileFormat.Cells</a> is planning to add more functionalities to its features bucket. However, after the successful launch of <a href="https://fileformat-cells.github.io/FileFormat.Cells-for-.NET/">FileFormat.Cells</a> and <a href="https://fileformat-words.github.io/FileFormat.Words-for-.NET/">FileFormat.Words</a> the development of FileFormat.Slides is a work in progress. So, stay in touch for regular updates. </p>

0 commit comments

Comments
 (0)