File tree Expand file tree Collapse file tree 5 files changed +63
-0
lines changed
FAQ/Border styles for merged cells/.NET/Borderstylesformergedcells
Borderstylesformergedcells Expand file tree Collapse file tree 5 files changed +63
-0
lines changed Original file line number Diff line number Diff line change 1+ <Solution >
2+ <Project Path =" Borderstylesformergedcells/Borderstylesformergedcells.csproj" />
3+ </Solution >
Original file line number Diff line number Diff line change 1+ <Project Sdk =" Microsoft.NET.Sdk" >
2+
3+ <PropertyGroup >
4+ <OutputType >Exe</OutputType >
5+ <TargetFramework >net8.0</TargetFramework >
6+ <ImplicitUsings >enable</ImplicitUsings >
7+ <Nullable >enable</Nullable >
8+ </PropertyGroup >
9+
10+ <ItemGroup >
11+ <PackageReference Include =" Syncfusion.XlsIO.Net.Core" Version =" *" />
12+ </ItemGroup >
13+
14+ <ItemGroup >
15+ <None Update =" Output\*" >
16+ <CopyToOutputDirectory >Always</CopyToOutputDirectory >
17+ </None >
18+ </ItemGroup >
19+
20+ </Project >
Original file line number Diff line number Diff line change 1+ using Syncfusion . XlsIO ;
2+
3+ namespace Sample
4+ {
5+ class Program
6+ {
7+ static void Main ( string [ ] args )
8+ {
9+ using ( ExcelEngine excelEngine = new ExcelEngine ( ) )
10+ {
11+ IApplication application = excelEngine . Excel ;
12+ application . DefaultVersion = ExcelVersion . Xlsx ;
13+ IWorkbook workbook = application . Workbooks . Open ( "../../../Data/Input.xlsx" ) ;
14+ IWorksheet worksheet = workbook . Worksheets [ 0 ] ;
15+
16+ # region Creating a new style
17+ IStyle style = workbook . Styles . Add ( "NewStyle" ) ;
18+
19+ style . Borders [ ExcelBordersIndex . EdgeLeft ] . LineStyle = ExcelLineStyle . Thick ;
20+ style . Borders [ ExcelBordersIndex . EdgeRight ] . LineStyle = ExcelLineStyle . Thick ;
21+ style . Borders [ ExcelBordersIndex . EdgeTop ] . LineStyle = ExcelLineStyle . Thick ;
22+ style . Borders [ ExcelBordersIndex . EdgeBottom ] . LineStyle = ExcelLineStyle . Thick ;
23+ style . Borders . Color = ExcelKnownColors . Red ;
24+
25+ style . Font . Bold = true ;
26+ style . Font . Color = ExcelKnownColors . Green ;
27+ style . Font . Size = 24 ;
28+ #endregion
29+
30+ //Applying style for merged region
31+ worksheet . Range [ 2 , 1 ] . MergeArea . CellStyle = style ;
32+
33+ workbook . SaveAs ( "../../../Output/MergeArea_Style.xlsx" ) ;
34+ }
35+ }
36+
37+
38+ }
39+
40+ }
You can’t perform that action at this time.
0 commit comments