File tree Expand file tree Collapse file tree
FAQ/Chart/.NET/Chart Axis Manual Positioning/.NET/Chart Axis Manual Positioning
Chart Axis Manual Positioning Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ <Solution >
2+ <Project Path =" Chart Axis Manual Positioning/Chart Axis Manual Positioning.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+ <RootNamespace >Chart_Axis_Manual_Positioning</RootNamespace >
7+ <ImplicitUsings >enable</ImplicitUsings >
8+ <Nullable >enable</Nullable >
9+ </PropertyGroup >
10+
11+ <ItemGroup >
12+ <PackageReference Include =" Syncfusion.XlsIO.Net.Core" Version =" *" />
13+ </ItemGroup >
14+
15+ <ItemGroup >
16+ <None Update =" Data\*" >
17+ <CopyToOutputDirectory >Always</CopyToOutputDirectory >
18+ </None >
19+ <None Update =" Output\*" >
20+ <CopyToOutputDirectory >Always</CopyToOutputDirectory >
21+ </None >
22+ </ItemGroup >
23+
24+ </Project >
Original file line number Diff line number Diff line change 1+
Original file line number Diff line number Diff line change 1+ using Syncfusion . XlsIO ;
2+
3+ class Program
4+ {
5+ static void Main ( string [ ] args )
6+ {
7+ using ( ExcelEngine excelEngine = new ExcelEngine ( ) )
8+ {
9+ IWorkbook workbook = excelEngine . Excel . Workbooks . Open ( Path . GetFullPath ( @"Data/InputTemplate.xlsx" ) ) ;
10+ IWorksheet worksheet = workbook . Worksheets [ 0 ] ;
11+
12+ // Access the chart in the worksheet
13+ IChartShape chart = worksheet . Charts [ 0 ] ;
14+
15+ chart . PrimaryValueAxis . TitleArea . Layout . ManualLayout . Top = 0.15 ; // Adjust the vertical position of the title
16+
17+
18+ // Save the modified workbook
19+ workbook . SaveAs ( Path . GetFullPath ( @"Output/Output.xlsx" ) ) ;
20+ }
21+ }
22+ }
You can’t perform that action at this time.
0 commit comments