Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions FAQ/ReadOnly Excel/.NET/Readonly Excel/Readonly Excel.slnx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<Solution>
<Project Path="Readonly Excel/Readonly Excel.csproj" />
</Solution>
Empty file.
31 changes: 31 additions & 0 deletions FAQ/ReadOnly Excel/.NET/Readonly Excel/Readonly Excel/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using Syncfusion.XlsIO;

class Program
{
static void Main(string[] args)
{
using (ExcelEngine excelEngine = new ExcelEngine())
{
// Instantiate the Excel application object
IApplication application = excelEngine.Excel;

// Assigns default application version
application.DefaultVersion = ExcelVersion.Xlsx;

// Create a workbook with 1 worksheet
IWorkbook workbook = application.Workbooks.Create(1);

// Access first worksheet from the workbook
IWorksheet worksheet = workbook.Worksheets[0];

// Adding text to a cell
worksheet.Range["A1"].Text = "Hello World";

// Protect the worksheet
worksheet.Protect("syncfusion", ExcelSheetProtection.All);

// Save the workbook to disk in XLSX format
workbook.SaveAs(Path.GetFullPath("Output/Output.xlsx"));
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>Readonly_Excel</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Syncfusion.XlsIO.Net.Core" Version="*" />
</ItemGroup>

<ItemGroup>
<None Update="Output\*">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>

</Project>
Loading