Skip to content

Commit 5c8b85c

Browse files
authored
Merge pull request #157 from SyncfusionExamples/InteractiveDemoPage
InteractiveDemoPage for XlsIO
2 parents e256215 + 624e953 commit 5c8b85c

File tree

3 files changed

+14
-11
lines changed
  • Conditional Formatting/Create Conditional Format/.NET/Create Conditional Format/Create Conditional Format
  • Convert Excel to JSON/Workbook to JSON with Schema/.NET/Workbook to JSON with Schema/Workbook to JSON with Schema
  • XlsIO-Excel-Protect-UnProtect/Protect-Workbook/.NET/Protect-Workbook/ProtectWorkbook

3 files changed

+14
-11
lines changed

Conditional Formatting/Create Conditional Format/.NET/Create Conditional Format/Create Conditional Format/Program.cs

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,45 +14,48 @@ static void Main(string[] args)
1414
IWorkbook workbook = application.Workbooks.Create(1);
1515
IWorksheet worksheet = workbook.Worksheets[0];
1616

17-
//Applying conditional formatting to "A1"
18-
IConditionalFormats condition = worksheet.Range["A1"].ConditionalFormats;
17+
//Applying conditional formatting to "F2"
18+
IConditionalFormats condition = worksheet.Range["F2"].ConditionalFormats;
1919
IConditionalFormat condition1 = condition.AddCondition();
2020

2121
//Represents conditional format rule that the value in target range should be between 10 and 20
2222
condition1.FormatType = ExcelCFType.CellValue;
2323
condition1.Operator = ExcelComparisonOperator.Between;
2424
condition1.FirstFormula = "10";
2525
condition1.SecondFormula = "20";
26-
worksheet.Range["A1"].Text = "Enter a number between 10 and 20";
26+
worksheet.Range["A2"].Text = "Enter a number between 10 and 20";
27+
worksheet.Range["F2"].BorderAround(ExcelLineStyle.Thin);
2728

2829
//Setting back color and font style to be applied for target range
2930
condition1.BackColor = ExcelKnownColors.Light_orange;
3031
condition1.IsBold = true;
3132
condition1.IsItalic = true;
3233

33-
//Applying conditional formatting to "A3"
34-
condition = worksheet.Range["A3"].ConditionalFormats;
34+
//Applying conditional formatting to "F4"
35+
condition = worksheet.Range["F4"].ConditionalFormats;
3536
IConditionalFormat condition2 = condition.AddCondition();
3637

3738
//Represents conditional format rule that the cell value should be 1000
3839
condition2.FormatType = ExcelCFType.CellValue;
3940
condition2.Operator = ExcelComparisonOperator.Equal;
4041
condition2.FirstFormula = "1000";
41-
worksheet.Range["A3"].Text = "Enter the Number as 1000";
42+
worksheet.Range["A4"].Text = "Enter the Number as 1000";
43+
worksheet.Range["F4"].BorderAround(ExcelLineStyle.Thin);
4244

4345
//Setting fill pattern and back color to target range
4446
condition2.FillPattern = ExcelPattern.LightUpwardDiagonal;
4547
condition2.BackColor = ExcelKnownColors.Yellow;
4648

47-
//Applying conditional formatting to "A5"
48-
condition = worksheet.Range["A5"].ConditionalFormats;
49+
//Applying conditional formatting to "F6"
50+
condition = worksheet.Range["F6"].ConditionalFormats;
4951
IConditionalFormat condition3 = condition.AddCondition();
5052

5153
//Setting conditional format rule that the cell value for target range should be less than or equal to 1000
5254
condition3.FormatType = ExcelCFType.CellValue;
5355
condition3.Operator = ExcelComparisonOperator.LessOrEqual;
5456
condition3.FirstFormula = "1000";
55-
worksheet.Range["A5"].Text = "Enter a Number which is less than or equal to 1000";
57+
worksheet.Range["A6"].Text = "Enter a Number which is less than or equal to 1000";
58+
worksheet.Range["F6"].BorderAround(ExcelLineStyle.Thin);
5659

5760
//Setting back color to target range
5861
condition3.BackColor = ExcelKnownColors.Light_green;

Convert Excel to JSON/Workbook to JSON with Schema/.NET/Workbook to JSON with Schema/Workbook to JSON with Schema/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ static void Main(string[] args)
2222
workbook.SaveAsJson(outputStream);
2323

2424
//Saves the workbook to a JSON filestream as schema
25-
FileStream stream1 = new FileStream("Output/Excel-Workbook-To-JSON-as-schema.json", FileMode.Create, FileAccess.ReadWrite);
25+
FileStream stream1 = new FileStream(Path.GetFullPath("Output/Excel-Workbook-To-JSON-as-schema.json"), FileMode.Create, FileAccess.ReadWrite);
2626
workbook.SaveAsJson(stream1, true);
2727
#endregion
2828

XlsIO-Excel-Protect-UnProtect/Protect-Workbook/.NET/Protect-Workbook/ProtectWorkbook/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Protect a workbook with a password using C#
22

3-
The Syncfusion® [.NET Excel Library](https://www.syncfusion.com/document-processing/excel-framework/net/excel-library) (XlsIO) enables you to create, read, and edit Excel documents programmatically without Microsoft Excel or interop dependencies. Using this library, you can **protect a workbook with a password** using C#.
3+
The Syncfusion® [.NET Excel Library](https://www.syncfusion.com/document-processing/excel-framework/net/excel-library) (XlsIO) enables you to create, read, and edit Excel documents programmatically without Microsoft Excel or interop dependencies. Using this library, you can **protect a workbook with a password** using C#. After adding workbook protection, the structural changes of the workbook are disabled.
44

55
## Steps to protect a workbook with a password programmatically
66

0 commit comments

Comments
 (0)