-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDefinedNames.cpp
More file actions
26 lines (19 loc) · 964 Bytes
/
DefinedNames.cpp
File metadata and controls
26 lines (19 loc) · 964 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include <iostream>
#include <Xlsx/Workbook.h>
using namespace SimpleXlsx;
int main()
{
CWorkbook Book( "Incognito" );
CWorksheet & Sheet = Book.AddSheet( "Sheet 1" );
CWorksheet & SecondSheet = Book.AddSheet( "Sheet 2" );
Book.AddDefinedName( "HalfRad", 0.5, "Half radian" ).AddDefinedName( "TestSin", "sin(HalfRad)" );
Book.AddDefinedName( "SingleCell", Sheet, CellCoord( 1, 0 ) );
Book.AddDefinedName( "RangeCells", Sheet, CellCoord( 1, 0 ), CellCoord( 2, 0 ) );
Book.AddDefinedName( "TestScope", Sheet, CellCoord( 1, 0 ), "", & SecondSheet );
Sheet.AddSimpleRow( "=HalfRad" ).AddSimpleRow( "=TestSin" );
Sheet.AddSimpleRow( "=SingleCell" ).AddSimpleRow( "=sum(RangeCells)" );
SecondSheet.AddSimpleRow( "=TestScope" );
if( Book.Save( "DefinedNames.xlsx" ) ) std::cout << "The book has been saved successfully" << std::endl;
else std::cout << "The book saving has been failed" << std::endl;
return 0;
}