SlideShare a Scribd company logo
1 of 7
Download to read offline
>> IN THE NAME OF GOD << 
Import Data from CSV EXCEL file and Export to XML EXCEL file in C programming 
 
C program is written by Salar Delavar Ghashghaei – Publication Date: 27/May/2018 
E‐mail: salar.d.ghashghaei@gmail.com 
C Code:
#include <conio.h>
#include <stdio.h>
#include <windows.h>
#define N 10000
#define ShowText01 "CSV_C_XMLexcel-input.csv"
#define ShowText02 "outputXML.xml"
void IMPORT_DATA01(double X[],double Y[],int &n);
void MessageCheck_IMPORT_DATA01(double X[],double Y[],int n);
void MessageErrorReportTEXT();
void DATA_TABLE(double X[],double Y[],int n);
void OUTPUT_XML(double X[],double Y[],int n,const char SheetName[],const char TableName[],int NumCol,int NumRow,int FontSize);
int main(){
int n,NumCol,NumRow,FontSize;
double X[N],Y[N];
char SheetName[50],TableName[50];
IMPORT_DATA01(X,Y,n);
MessageCheck_IMPORT_DATA01(X,Y,n);
DATA_TABLE(X,Y,n);
OUTPUT_XML(X,Y,n,"DATA_TABLE","X_Y Data",2,n,11);
system("start /w outputXML.xml");
getch();
return 0;
}
void IMPORT_DATA01(double X[],double Y[],int &n){
int i = 0;
FILE *InputFile;
InputFile = fopen(ShowText01, "r");
if (!InputFile){
MessageErrorReportTEXT();
printf(" File is not available! -> [%s] n",ShowText01);
Sleep(6000);
exit(1);
}
char line[1000];
do{
fscanf(InputFile,"%lf,%lf",&X[i],&Y[i]);
//printf("%d - X[%d]: %lf - Y[%d]: %lfn",i,i,X[i],i,Y[i]);
i++;
}
while(i < N && fgets(line,sizeof(line),InputFile) != NULL);
n = i-1;
}
void MessageCheck_IMPORT_DATA01(double X[],double Y[],int n){
int i;
for(i=0;i<n;i++){
if (X[i] < 0 || Y[i] < 0 ){
MessageErrorReportTEXT();
printf(" Please check the input file! -> [%s]n",ShowText01);
printf(" Row %d has a negative value.n",i+1);
printf("n X[%d]: %f - ",i+1,X[i]);printf("Y[%d]: %fn",i+1,Y[i]);
printf(" *** Negative data input value is not acceptable ***n");
Sleep(40000);
exit(1);
}
}
}
void MessageErrorReportTEXT(){
int i;
char Ql;
Ql=176;
printf("an ");
for (i=1;i<50;i++)
printf("%c",Ql);
printf(" Error Report ");
for (i=1;i<50;i++)
printf("%c",Ql);
printf("n");
}
void DATA_TABLE(double X[],double Y[],int n){
int i;
char Qa,Qb,Qc,Qd,Qe,Qf;
int BB=201,CC=205,DD=187,EE=200,FF=188,GG=186;
Qa=BB;Qb=CC;Qc=DD;Qd=EE;Qe=FF;Qf=GG;
printf(" %c",Qa);
for (i=1;i<45;i++)
printf("%c",Qb);
printf("%cn",Qc);
printf(" %c X-Y Data Table %cn",Qf,Qf);
printf(" %c Number X Y %cn",Qf,Qf);
printf(" %c",Qd);
for (i=1;i<45;i++)
printf("%c",Qb);
printf("%cn",Qe);
for(i=0;i<n;i++)
printf("t %d %.3e %.3en",i+1,X[i],Y[i]);
}
void OUTPUT_XML(double X[],double Y[],int n,const char SheetName[],const char TableName[],int NumCol,int NumRow,int FontSize){
FILE *OutputFile;
OutputFile = fopen(ShowText02, "w");
fprintf(OutputFile,"<?xml version="1.0"?>n");
fprintf(OutputFile,"<?mso-application progid="Excel.Sheet"?> n");
fprintf(OutputFile,"<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" n");
fprintf(OutputFile,"xmlns:o="urn:schemas-microsoft-com:office:office" n");
fprintf(OutputFile,"xmlns:x="urn:schemas-microsoft-com:office:excel" n");
fprintf(OutputFile,"xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" n");
fprintf(OutputFile,"xmlns:html="http://www.w3.org/TR/REC-html40"> n");
fprintf(OutputFile,"<DocumentProperties xmlns="urn:schemas-microsoft-com:office:office"> n");
fprintf(OutputFile,"<Author>SALAR DELAVAR GHASHGHAEI</Author> n");
fprintf(OutputFile,"<LastAuthor>Windows User</LastAuthor> n");
fprintf(OutputFile,"<Created>2019-05-27T12:20:49Z</Created> n");
fprintf(OutputFile,"<Version>15.00</Version> n");
fprintf(OutputFile,"</DocumentProperties> n");
fprintf(OutputFile,"<OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office"> n");
fprintf(OutputFile,"<AllowPNG/> n");
fprintf(OutputFile,"</OfficeDocumentSettings> n");
fprintf(OutputFile,"<ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel"> n");
fprintf(OutputFile,"<WindowHeight>7905</WindowHeight> n");
fprintf(OutputFile,"<WindowWidth>20490</WindowWidth> n");
fprintf(OutputFile,"<WindowTopX>0</WindowTopX> n");
fprintf(OutputFile,"<WindowTopY>0</WindowTopY> n");
fprintf(OutputFile,"<ProtectStructure>False</ProtectStructure> n");
fprintf(OutputFile,"<ProtectWindows>False</ProtectWindows> n");
fprintf(OutputFile,"</ExcelWorkbook> n");
fprintf(OutputFile,"<Styles> n");
fprintf(OutputFile,"<Style ss:ID="Default" ss:Name="Normal"> n");
fprintf(OutputFile,"<Alignment ss:Vertical="Bottom"/> n");
fprintf(OutputFile,"<Borders/> n");
fprintf(OutputFile,"<Font ss:FontName="Calibri" x:Family="Swiss" ss:Size="%d" ss:Color="#00FF00"/> n",FontSize);///////////
fprintf(OutputFile,"<Interior/> n");
fprintf(OutputFile,"<NumberFormat/> n");
fprintf(OutputFile,"<Protection/> n");
fprintf(OutputFile,"</Style> n");
fprintf(OutputFile,"<Style ss:ID="s73"> n");
fprintf(OutputFile,"<Alignment ss:Horizontal="Center" ss:Vertical="Center"/> n");
fprintf(OutputFile,"<Borders> n");
fprintf(OutputFile,"<Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1"/> n");
fprintf(OutputFile,"<Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1"/> n");
fprintf(OutputFile,"<Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1"/> n");
fprintf(OutputFile,"<Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1"/> n");
fprintf(OutputFile,"</Borders> n");
fprintf(OutputFile,"</Style> n");
fprintf(OutputFile,"<Style ss:ID="s74"> n");
fprintf(OutputFile,"<Alignment ss:Horizontal="Center" ss:Vertical="Center"/> n");
fprintf(OutputFile,"<Borders> n");
fprintf(OutputFile,"<Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1"/> n");
fprintf(OutputFile,"<Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1"/> n");
fprintf(OutputFile,"<Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1"/> n");
fprintf(OutputFile,"<Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1"/> n");
fprintf(OutputFile,"</Borders> n");
fprintf(OutputFile,"</Style> n");
fprintf(OutputFile,"</Styles> n");
fprintf(OutputFile,"<Worksheet ss:Name="%s"> n",SheetName);
fprintf(OutputFile,"<Table ss:ExpandedColumnCount="%d" ss:ExpandedRowCount="%d" x:FullColumns="1" n",NumCol,NumRow+1);
fprintf(OutputFile,"x:FullRows="1" ss:DefaultRowHeight="15"> n");
fprintf(OutputFile,"<Row> n");
fprintf(OutputFile,"<Cell ss:MergeAcross="%d" ss:StyleID="s73"><Data ss:Type="String">%s</Data></Cell> n",NumCol-1,TableName);///
fprintf(OutputFile,"</Row> n");
for (int i=0;i<n;i++){
fprintf(OutputFile,"<Row> n");
fprintf(OutputFile,"<Cell ss:StyleID="s74"><Data ss:Type="String">%.5e</Data></Cell> n",X[i]);///
fprintf(OutputFile,"<Cell ss:StyleID="s74"><Data ss:Type="String">%.5e</Data></Cell> n",Y[i]);///
fprintf(OutputFile,"</Row> n");
}
fprintf(OutputFile,"</Table> n");
fprintf(OutputFile,"<WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel"> n");
fprintf(OutputFile,"<PageSetup> n");
fprintf(OutputFile,"<Header x:Margin="0.3"/> n");
fprintf(OutputFile,"<Footer x:Margin="0.3"/> n");
fprintf(OutputFile,"<PageMargins x:Bottom="0.75" x:Left="0.7" x:Right="0.7" x:Top="0.75"/> n");
fprintf(OutputFile,"</PageSetup> n");
fprintf(OutputFile,"<Selected/> n");
fprintf(OutputFile,"<ProtectObjects>False</ProtectObjects> n");
fprintf(OutputFile,"<ProtectScenarios>False</ProtectScenarios> n");
fprintf(OutputFile,"</WorksheetOptions> n");
fprintf(OutputFile,"</Worksheet> n");
fprintf(OutputFile,"</Workbook> n");
fclose(OutputFile);
}
Plot : 
 
Figure(1) Input data in CSV
 
Figure(2) Analysis data in C
 
Figure(3) Output data in XML EXCEL
 

More Related Content

What's hot

Model-View-Update, and Beyond!
Model-View-Update, and Beyond!Model-View-Update, and Beyond!
Model-View-Update, and Beyond!Simon Fowler
 
Informatics Practices/ Information Practices Project (IP Project Class 12)
Informatics Practices/ Information Practices Project (IP Project Class 12)Informatics Practices/ Information Practices Project (IP Project Class 12)
Informatics Practices/ Information Practices Project (IP Project Class 12)KushShah65
 
React London April- Fully functional: Central state is a great fit for React ...
React London April- Fully functional: Central state is a great fit for React ...React London April- Fully functional: Central state is a great fit for React ...
React London April- Fully functional: Central state is a great fit for React ...React London Community
 
systems programming lab programs in c
systems programming lab programs in csystems programming lab programs in c
systems programming lab programs in cMeghna Roy
 
Pushover analysis force analogy method with force control based on euler bern...
Pushover analysis force analogy method with force control based on euler bern...Pushover analysis force analogy method with force control based on euler bern...
Pushover analysis force analogy method with force control based on euler bern...Salar Delavar Qashqai
 
Mouse programming in c
Mouse programming in cMouse programming in c
Mouse programming in cgkgaur1987
 
Pushover analysis force analogy method with force control based on timoshenko...
Pushover analysis force analogy method with force control based on timoshenko...Pushover analysis force analogy method with force control based on timoshenko...
Pushover analysis force analogy method with force control based on timoshenko...Salar Delavar Qashqai
 
computer project code ''payroll'' (based on datafile handling)
computer project code ''payroll'' (based on datafile handling)computer project code ''payroll'' (based on datafile handling)
computer project code ''payroll'' (based on datafile handling)Nitish Yadav
 
PROGRAMMING USING C# .NET - SARASWATHI RAMALINGAM
PROGRAMMING USING C# .NET - SARASWATHI RAMALINGAMPROGRAMMING USING C# .NET - SARASWATHI RAMALINGAM
PROGRAMMING USING C# .NET - SARASWATHI RAMALINGAMSaraswathiRamalingam
 
Logic development
Logic developmentLogic development
Logic developmentJerin John
 
Excelマクロはじめの一歩
Excelマクロはじめの一歩Excelマクロはじめの一歩
Excelマクロはじめの一歩Ayumu Hanba
 
Effective C#
Effective C#Effective C#
Effective C#lantoli
 
Basic program in java
Basic program in java Basic program in java
Basic program in java Sudeep Singh
 

What's hot (20)

Model-View-Update, and Beyond!
Model-View-Update, and Beyond!Model-View-Update, and Beyond!
Model-View-Update, and Beyond!
 
Informatics Practices/ Information Practices Project (IP Project Class 12)
Informatics Practices/ Information Practices Project (IP Project Class 12)Informatics Practices/ Information Practices Project (IP Project Class 12)
Informatics Practices/ Information Practices Project (IP Project Class 12)
 
React London April- Fully functional: Central state is a great fit for React ...
React London April- Fully functional: Central state is a great fit for React ...React London April- Fully functional: Central state is a great fit for React ...
React London April- Fully functional: Central state is a great fit for React ...
 
systems programming lab programs in c
systems programming lab programs in csystems programming lab programs in c
systems programming lab programs in c
 
Pushover analysis force analogy method with force control based on euler bern...
Pushover analysis force analogy method with force control based on euler bern...Pushover analysis force analogy method with force control based on euler bern...
Pushover analysis force analogy method with force control based on euler bern...
 
Python program
Python programPython program
Python program
 
Quiz using C++
Quiz using C++Quiz using C++
Quiz using C++
 
Mouse programming in c
Mouse programming in cMouse programming in c
Mouse programming in c
 
Pushover analysis force analogy method with force control based on timoshenko...
Pushover analysis force analogy method with force control based on timoshenko...Pushover analysis force analogy method with force control based on timoshenko...
Pushover analysis force analogy method with force control based on timoshenko...
 
computer project code ''payroll'' (based on datafile handling)
computer project code ''payroll'' (based on datafile handling)computer project code ''payroll'' (based on datafile handling)
computer project code ''payroll'' (based on datafile handling)
 
Stl algorithm-Basic types
Stl algorithm-Basic typesStl algorithm-Basic types
Stl algorithm-Basic types
 
PROGRAMMING USING C# .NET - SARASWATHI RAMALINGAM
PROGRAMMING USING C# .NET - SARASWATHI RAMALINGAMPROGRAMMING USING C# .NET - SARASWATHI RAMALINGAM
PROGRAMMING USING C# .NET - SARASWATHI RAMALINGAM
 
C++ programs
C++ programsC++ programs
C++ programs
 
Logic development
Logic developmentLogic development
Logic development
 
Mock geecon2
Mock geecon2Mock geecon2
Mock geecon2
 
Pratik Bakane C++
Pratik Bakane C++Pratik Bakane C++
Pratik Bakane C++
 
Excelマクロはじめの一歩
Excelマクロはじめの一歩Excelマクロはじめの一歩
Excelマクロはじめの一歩
 
Effective C#
Effective C#Effective C#
Effective C#
 
C++ file
C++ fileC++ file
C++ file
 
Basic program in java
Basic program in java Basic program in java
Basic program in java
 

Similar to Import data from csv excel file and export to xml excel file in c programming

Moving Average Filter in C
Moving Average Filter in CMoving Average Filter in C
Moving Average Filter in CColin
 
Geometric and material nonlinearity analysis of 2 d truss with force and duct...
Geometric and material nonlinearity analysis of 2 d truss with force and duct...Geometric and material nonlinearity analysis of 2 d truss with force and duct...
Geometric and material nonlinearity analysis of 2 d truss with force and duct...Salar Delavar Qashqai
 
การเข ยนคำส _งควบค_มข__นพ__นฐาน (1)
การเข ยนคำส _งควบค_มข__นพ__นฐาน (1)การเข ยนคำส _งควบค_มข__นพ__นฐาน (1)
การเข ยนคำส _งควบค_มข__นพ__นฐาน (1)HamHam' Kc
 
การเข ยนคำส _งควบค_มข__นพ__นฐาน (2)
การเข ยนคำส _งควบค_มข__นพ__นฐาน (2)การเข ยนคำส _งควบค_มข__นพ__นฐาน (2)
การเข ยนคำส _งควบค_มข__นพ__นฐาน (2)Seenton Pukjira
 
การเขียนคำสั่งควบคุมขั้นพื้นฐาน
การเขียนคำสั่งควบคุมขั้นพื้นฐานการเขียนคำสั่งควบคุมขั้นพื้นฐาน
การเขียนคำสั่งควบคุมขั้นพื้นฐานHamHam' Kc
 
เธเธฒเธฃเน€เธ‚ เธขเธ™เธ„เธณเธช _เธ‡เธ„เธงเธšเธ„_เธกเธ‚__เธ™เธž__เธ™เธเธฒเธ™
เธเธฒเธฃเน€เธ‚ เธขเธ™เธ„เธณเธช _เธ‡เธ„เธงเธšเธ„_เธกเธ‚__เธ™เธž__เธ™เธเธฒเธ™เธเธฒเธฃเน€เธ‚ เธขเธ™เธ„เธณเธช _เธ‡เธ„เธงเธšเธ„_เธกเธ‚__เธ™เธž__เธ™เธเธฒเธ™
เธเธฒเธฃเน€เธ‚ เธขเธ™เธ„เธณเธช _เธ‡เธ„เธงเธšเธ„_เธกเธ‚__เธ™เธž__เธ™เธเธฒเธ™Boom Baphomet
 
Concepts of C [Module 2]
Concepts of C [Module 2]Concepts of C [Module 2]
Concepts of C [Module 2]Abhishek Sinha
 
Compiler design lab
Compiler design labCompiler design lab
Compiler design labilias ahmed
 
Critical buckling load geometric nonlinearity analysis of springs with rigid ...
Critical buckling load geometric nonlinearity analysis of springs with rigid ...Critical buckling load geometric nonlinearity analysis of springs with rigid ...
Critical buckling load geometric nonlinearity analysis of springs with rigid ...Salar Delavar Qashqai
 
Critical buckling load geometric nonlinearity analysis of springs with rigid ...
Critical buckling load geometric nonlinearity analysis of springs with rigid ...Critical buckling load geometric nonlinearity analysis of springs with rigid ...
Critical buckling load geometric nonlinearity analysis of springs with rigid ...Salar Delavar Qashqai
 
The Ring programming language version 1.2 book - Part 30 of 84
The Ring programming language version 1.2 book - Part 30 of 84The Ring programming language version 1.2 book - Part 30 of 84
The Ring programming language version 1.2 book - Part 30 of 84Mahmoud Samir Fayed
 
The Ring programming language version 1.5.2 book - Part 41 of 181
The Ring programming language version 1.5.2 book - Part 41 of 181The Ring programming language version 1.5.2 book - Part 41 of 181
The Ring programming language version 1.5.2 book - Part 41 of 181Mahmoud Samir Fayed
 
Introduction to Computer and Programing - Lecture 04
Introduction to Computer and Programing - Lecture 04Introduction to Computer and Programing - Lecture 04
Introduction to Computer and Programing - Lecture 04hassaanciit
 

Similar to Import data from csv excel file and export to xml excel file in c programming (20)

Moving Average Filter in C
Moving Average Filter in CMoving Average Filter in C
Moving Average Filter in C
 
Geometric and material nonlinearity analysis of 2 d truss with force and duct...
Geometric and material nonlinearity analysis of 2 d truss with force and duct...Geometric and material nonlinearity analysis of 2 d truss with force and duct...
Geometric and material nonlinearity analysis of 2 d truss with force and duct...
 
R Language
R LanguageR Language
R Language
 
การเข ยนคำส _งควบค_มข__นพ__นฐาน (1)
การเข ยนคำส _งควบค_มข__นพ__นฐาน (1)การเข ยนคำส _งควบค_มข__นพ__นฐาน (1)
การเข ยนคำส _งควบค_มข__นพ__นฐาน (1)
 
การเข ยนคำส _งควบค_มข__นพ__นฐาน (2)
การเข ยนคำส _งควบค_มข__นพ__นฐาน (2)การเข ยนคำส _งควบค_มข__นพ__นฐาน (2)
การเข ยนคำส _งควบค_มข__นพ__นฐาน (2)
 
การเขียนคำสั่งควบคุมขั้นพื้นฐาน
การเขียนคำสั่งควบคุมขั้นพื้นฐานการเขียนคำสั่งควบคุมขั้นพื้นฐาน
การเขียนคำสั่งควบคุมขั้นพื้นฐาน
 
เธเธฒเธฃเน€เธ‚ เธขเธ™เธ„เธณเธช _เธ‡เธ„เธงเธšเธ„_เธกเธ‚__เธ™เธž__เธ™เธเธฒเธ™
เธเธฒเธฃเน€เธ‚ เธขเธ™เธ„เธณเธช _เธ‡เธ„เธงเธšเธ„_เธกเธ‚__เธ™เธž__เธ™เธเธฒเธ™เธเธฒเธฃเน€เธ‚ เธขเธ™เธ„เธณเธช _เธ‡เธ„เธงเธšเธ„_เธกเธ‚__เธ™เธž__เธ™เธเธฒเธ™
เธเธฒเธฃเน€เธ‚ เธขเธ™เธ„เธณเธช _เธ‡เธ„เธงเธšเธ„_เธกเธ‚__เธ™เธž__เธ™เธเธฒเธ™
 
Pnno
PnnoPnno
Pnno
 
Concepts of C [Module 2]
Concepts of C [Module 2]Concepts of C [Module 2]
Concepts of C [Module 2]
 
C- Programming Assignment 3
C- Programming Assignment 3C- Programming Assignment 3
C- Programming Assignment 3
 
C Programming
C ProgrammingC Programming
C Programming
 
Compiler design lab
Compiler design labCompiler design lab
Compiler design lab
 
Critical buckling load geometric nonlinearity analysis of springs with rigid ...
Critical buckling load geometric nonlinearity analysis of springs with rigid ...Critical buckling load geometric nonlinearity analysis of springs with rigid ...
Critical buckling load geometric nonlinearity analysis of springs with rigid ...
 
Critical buckling load geometric nonlinearity analysis of springs with rigid ...
Critical buckling load geometric nonlinearity analysis of springs with rigid ...Critical buckling load geometric nonlinearity analysis of springs with rigid ...
Critical buckling load geometric nonlinearity analysis of springs with rigid ...
 
The Ring programming language version 1.2 book - Part 30 of 84
The Ring programming language version 1.2 book - Part 30 of 84The Ring programming language version 1.2 book - Part 30 of 84
The Ring programming language version 1.2 book - Part 30 of 84
 
C Programming Example
C Programming ExampleC Programming Example
C Programming Example
 
The Ring programming language version 1.5.2 book - Part 41 of 181
The Ring programming language version 1.5.2 book - Part 41 of 181The Ring programming language version 1.5.2 book - Part 41 of 181
The Ring programming language version 1.5.2 book - Part 41 of 181
 
C Programming Example
C Programming Example C Programming Example
C Programming Example
 
Introduction to Computer and Programing - Lecture 04
Introduction to Computer and Programing - Lecture 04Introduction to Computer and Programing - Lecture 04
Introduction to Computer and Programing - Lecture 04
 
week-2x
week-2xweek-2x
week-2x
 

More from Salar Delavar Qashqai

Pushover 2order (p delta effect) analysis force analogy method with force con...
Pushover 2order (p delta effect) analysis force analogy method with force con...Pushover 2order (p delta effect) analysis force analogy method with force con...
Pushover 2order (p delta effect) analysis force analogy method with force con...Salar Delavar Qashqai
 
Pushover analysis of frame by force analogy method with force control based o...
Pushover analysis of frame by force analogy method with force control based o...Pushover analysis of frame by force analogy method with force control based o...
Pushover analysis of frame by force analogy method with force control based o...Salar Delavar Qashqai
 
Geometric nonlinearity analysis of springs with rigid element displacement co...
Geometric nonlinearity analysis of springs with rigid element displacement co...Geometric nonlinearity analysis of springs with rigid element displacement co...
Geometric nonlinearity analysis of springs with rigid element displacement co...Salar Delavar Qashqai
 
Nonlinear analysis of braced frame with hinge by hinge method in c programming
Nonlinear analysis of braced frame with hinge by hinge method in c programmingNonlinear analysis of braced frame with hinge by hinge method in c programming
Nonlinear analysis of braced frame with hinge by hinge method in c programmingSalar Delavar Qashqai
 
Truss optimization with excel solver
Truss optimization with excel solverTruss optimization with excel solver
Truss optimization with excel solverSalar Delavar Qashqai
 
Pushover analysis of triangular steel membrane element subjected to lateral d...
Pushover analysis of triangular steel membrane element subjected to lateral d...Pushover analysis of triangular steel membrane element subjected to lateral d...
Pushover analysis of triangular steel membrane element subjected to lateral d...Salar Delavar Qashqai
 
Pushover analysis of simply support steel section beam based on plastic hinge...
Pushover analysis of simply support steel section beam based on plastic hinge...Pushover analysis of simply support steel section beam based on plastic hinge...
Pushover analysis of simply support steel section beam based on plastic hinge...Salar Delavar Qashqai
 
Pushover analysis of steel section beam subjected to incremental vertical loa...
Pushover analysis of steel section beam subjected to incremental vertical loa...Pushover analysis of steel section beam subjected to incremental vertical loa...
Pushover analysis of steel section beam subjected to incremental vertical loa...Salar Delavar Qashqai
 
Moment curvature analysis of unconfined concrete section with matlab and sap2000
Moment curvature analysis of unconfined concrete section with matlab and sap2000Moment curvature analysis of unconfined concrete section with matlab and sap2000
Moment curvature analysis of unconfined concrete section with matlab and sap2000Salar Delavar Qashqai
 
Large deformation analysis of cantilever beam subjected to concentrated const...
Large deformation analysis of cantilever beam subjected to concentrated const...Large deformation analysis of cantilever beam subjected to concentrated const...
Large deformation analysis of cantilever beam subjected to concentrated const...Salar Delavar Qashqai
 
Moment curvature analysis unconfined concrete section with different tension...
Moment curvature analysis unconfined concrete section  with different tension...Moment curvature analysis unconfined concrete section  with different tension...
Moment curvature analysis unconfined concrete section with different tension...Salar Delavar Qashqai
 
Optimization of steel section based on moment and section ductility
Optimization of steel section based on moment and section ductilityOptimization of steel section based on moment and section ductility
Optimization of steel section based on moment and section ductilitySalar Delavar Qashqai
 
Nonlinear analysis of 2 d cantilever nonprismatic beam with plastic hinge con...
Nonlinear analysis of 2 d cantilever nonprismatic beam with plastic hinge con...Nonlinear analysis of 2 d cantilever nonprismatic beam with plastic hinge con...
Nonlinear analysis of 2 d cantilever nonprismatic beam with plastic hinge con...Salar Delavar Qashqai
 
Elastic response pseudo spectrum in c programming
Elastic response pseudo spectrum in c programmingElastic response pseudo spectrum in c programming
Elastic response pseudo spectrum in c programmingSalar Delavar Qashqai
 
Structural eigen value analysis in c programming
Structural eigen value analysis in c programmingStructural eigen value analysis in c programming
Structural eigen value analysis in c programmingSalar Delavar Qashqai
 
Analysis of 1st order and 2nd order nonlinear semi rigid connection braced fr...
Analysis of 1st order and 2nd order nonlinear semi rigid connection braced fr...Analysis of 1st order and 2nd order nonlinear semi rigid connection braced fr...
Analysis of 1st order and 2nd order nonlinear semi rigid connection braced fr...Salar Delavar Qashqai
 
Analysis of 1st order and 2nd order nonlinear semi rigid connection frame sub...
Analysis of 1st order and 2nd order nonlinear semi rigid connection frame sub...Analysis of 1st order and 2nd order nonlinear semi rigid connection frame sub...
Analysis of 1st order and 2nd order nonlinear semi rigid connection frame sub...Salar Delavar Qashqai
 
Moment curvature analysis confined concrete section in matlab
Moment curvature analysis confined concrete section in matlabMoment curvature analysis confined concrete section in matlab
Moment curvature analysis confined concrete section in matlabSalar Delavar Qashqai
 
Moment curvature analysis of unconfined circular concrete pipe section with m...
Moment curvature analysis of unconfined circular concrete pipe section with m...Moment curvature analysis of unconfined circular concrete pipe section with m...
Moment curvature analysis of unconfined circular concrete pipe section with m...Salar Delavar Qashqai
 
Nonlinear analysis of fixed support beam with hinge by hinge method in c prog...
Nonlinear analysis of fixed support beam with hinge by hinge method in c prog...Nonlinear analysis of fixed support beam with hinge by hinge method in c prog...
Nonlinear analysis of fixed support beam with hinge by hinge method in c prog...Salar Delavar Qashqai
 

More from Salar Delavar Qashqai (20)

Pushover 2order (p delta effect) analysis force analogy method with force con...
Pushover 2order (p delta effect) analysis force analogy method with force con...Pushover 2order (p delta effect) analysis force analogy method with force con...
Pushover 2order (p delta effect) analysis force analogy method with force con...
 
Pushover analysis of frame by force analogy method with force control based o...
Pushover analysis of frame by force analogy method with force control based o...Pushover analysis of frame by force analogy method with force control based o...
Pushover analysis of frame by force analogy method with force control based o...
 
Geometric nonlinearity analysis of springs with rigid element displacement co...
Geometric nonlinearity analysis of springs with rigid element displacement co...Geometric nonlinearity analysis of springs with rigid element displacement co...
Geometric nonlinearity analysis of springs with rigid element displacement co...
 
Nonlinear analysis of braced frame with hinge by hinge method in c programming
Nonlinear analysis of braced frame with hinge by hinge method in c programmingNonlinear analysis of braced frame with hinge by hinge method in c programming
Nonlinear analysis of braced frame with hinge by hinge method in c programming
 
Truss optimization with excel solver
Truss optimization with excel solverTruss optimization with excel solver
Truss optimization with excel solver
 
Pushover analysis of triangular steel membrane element subjected to lateral d...
Pushover analysis of triangular steel membrane element subjected to lateral d...Pushover analysis of triangular steel membrane element subjected to lateral d...
Pushover analysis of triangular steel membrane element subjected to lateral d...
 
Pushover analysis of simply support steel section beam based on plastic hinge...
Pushover analysis of simply support steel section beam based on plastic hinge...Pushover analysis of simply support steel section beam based on plastic hinge...
Pushover analysis of simply support steel section beam based on plastic hinge...
 
Pushover analysis of steel section beam subjected to incremental vertical loa...
Pushover analysis of steel section beam subjected to incremental vertical loa...Pushover analysis of steel section beam subjected to incremental vertical loa...
Pushover analysis of steel section beam subjected to incremental vertical loa...
 
Moment curvature analysis of unconfined concrete section with matlab and sap2000
Moment curvature analysis of unconfined concrete section with matlab and sap2000Moment curvature analysis of unconfined concrete section with matlab and sap2000
Moment curvature analysis of unconfined concrete section with matlab and sap2000
 
Large deformation analysis of cantilever beam subjected to concentrated const...
Large deformation analysis of cantilever beam subjected to concentrated const...Large deformation analysis of cantilever beam subjected to concentrated const...
Large deformation analysis of cantilever beam subjected to concentrated const...
 
Moment curvature analysis unconfined concrete section with different tension...
Moment curvature analysis unconfined concrete section  with different tension...Moment curvature analysis unconfined concrete section  with different tension...
Moment curvature analysis unconfined concrete section with different tension...
 
Optimization of steel section based on moment and section ductility
Optimization of steel section based on moment and section ductilityOptimization of steel section based on moment and section ductility
Optimization of steel section based on moment and section ductility
 
Nonlinear analysis of 2 d cantilever nonprismatic beam with plastic hinge con...
Nonlinear analysis of 2 d cantilever nonprismatic beam with plastic hinge con...Nonlinear analysis of 2 d cantilever nonprismatic beam with plastic hinge con...
Nonlinear analysis of 2 d cantilever nonprismatic beam with plastic hinge con...
 
Elastic response pseudo spectrum in c programming
Elastic response pseudo spectrum in c programmingElastic response pseudo spectrum in c programming
Elastic response pseudo spectrum in c programming
 
Structural eigen value analysis in c programming
Structural eigen value analysis in c programmingStructural eigen value analysis in c programming
Structural eigen value analysis in c programming
 
Analysis of 1st order and 2nd order nonlinear semi rigid connection braced fr...
Analysis of 1st order and 2nd order nonlinear semi rigid connection braced fr...Analysis of 1st order and 2nd order nonlinear semi rigid connection braced fr...
Analysis of 1st order and 2nd order nonlinear semi rigid connection braced fr...
 
Analysis of 1st order and 2nd order nonlinear semi rigid connection frame sub...
Analysis of 1st order and 2nd order nonlinear semi rigid connection frame sub...Analysis of 1st order and 2nd order nonlinear semi rigid connection frame sub...
Analysis of 1st order and 2nd order nonlinear semi rigid connection frame sub...
 
Moment curvature analysis confined concrete section in matlab
Moment curvature analysis confined concrete section in matlabMoment curvature analysis confined concrete section in matlab
Moment curvature analysis confined concrete section in matlab
 
Moment curvature analysis of unconfined circular concrete pipe section with m...
Moment curvature analysis of unconfined circular concrete pipe section with m...Moment curvature analysis of unconfined circular concrete pipe section with m...
Moment curvature analysis of unconfined circular concrete pipe section with m...
 
Nonlinear analysis of fixed support beam with hinge by hinge method in c prog...
Nonlinear analysis of fixed support beam with hinge by hinge method in c prog...Nonlinear analysis of fixed support beam with hinge by hinge method in c prog...
Nonlinear analysis of fixed support beam with hinge by hinge method in c prog...
 

Recently uploaded

Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxDeepakSakkari2
 
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)dollysharma2066
 
pipeline in computer architecture design
pipeline in computer architecture  designpipeline in computer architecture  design
pipeline in computer architecture designssuser87fa0c1
 
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfCCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfAsst.prof M.Gokilavani
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSCAESB
 
Work Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvWork Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvLewisJB
 
Introduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHIntroduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHC Sai Kiran
 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxbritheesh05
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...VICTOR MAESTRE RAMIREZ
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfAsst.prof M.Gokilavani
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.eptoze12
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxwendy cai
 
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEroselinkalist12
 
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ
 
Effects of rheological properties on mixing
Effects of rheological properties on mixingEffects of rheological properties on mixing
Effects of rheological properties on mixingviprabot1
 

Recently uploaded (20)

Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptx
 
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
 
POWER SYSTEMS-1 Complete notes examples
POWER SYSTEMS-1 Complete notes  examplesPOWER SYSTEMS-1 Complete notes  examples
POWER SYSTEMS-1 Complete notes examples
 
pipeline in computer architecture design
pipeline in computer architecture  designpipeline in computer architecture  design
pipeline in computer architecture design
 
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfCCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentation
 
Work Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvWork Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvv
 
young call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Serviceyoung call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Service
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
Introduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHIntroduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECH
 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptx
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.
 
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptx
 
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
 
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
 
Effects of rheological properties on mixing
Effects of rheological properties on mixingEffects of rheological properties on mixing
Effects of rheological properties on mixing
 

Import data from csv excel file and export to xml excel file in c programming

  • 1. >> IN THE NAME OF GOD <<  Import Data from CSV EXCEL file and Export to XML EXCEL file in C programming    C program is written by Salar Delavar Ghashghaei – Publication Date: 27/May/2018  E‐mail: salar.d.ghashghaei@gmail.com  C Code: #include <conio.h> #include <stdio.h> #include <windows.h> #define N 10000 #define ShowText01 "CSV_C_XMLexcel-input.csv" #define ShowText02 "outputXML.xml" void IMPORT_DATA01(double X[],double Y[],int &n); void MessageCheck_IMPORT_DATA01(double X[],double Y[],int n); void MessageErrorReportTEXT(); void DATA_TABLE(double X[],double Y[],int n); void OUTPUT_XML(double X[],double Y[],int n,const char SheetName[],const char TableName[],int NumCol,int NumRow,int FontSize); int main(){ int n,NumCol,NumRow,FontSize; double X[N],Y[N]; char SheetName[50],TableName[50]; IMPORT_DATA01(X,Y,n); MessageCheck_IMPORT_DATA01(X,Y,n); DATA_TABLE(X,Y,n); OUTPUT_XML(X,Y,n,"DATA_TABLE","X_Y Data",2,n,11); system("start /w outputXML.xml"); getch(); return 0; } void IMPORT_DATA01(double X[],double Y[],int &n){ int i = 0; FILE *InputFile; InputFile = fopen(ShowText01, "r"); if (!InputFile){ MessageErrorReportTEXT(); printf(" File is not available! -> [%s] n",ShowText01); Sleep(6000); exit(1); } char line[1000]; do{ fscanf(InputFile,"%lf,%lf",&X[i],&Y[i]); //printf("%d - X[%d]: %lf - Y[%d]: %lfn",i,i,X[i],i,Y[i]); i++; }
  • 2. while(i < N && fgets(line,sizeof(line),InputFile) != NULL); n = i-1; } void MessageCheck_IMPORT_DATA01(double X[],double Y[],int n){ int i; for(i=0;i<n;i++){ if (X[i] < 0 || Y[i] < 0 ){ MessageErrorReportTEXT(); printf(" Please check the input file! -> [%s]n",ShowText01); printf(" Row %d has a negative value.n",i+1); printf("n X[%d]: %f - ",i+1,X[i]);printf("Y[%d]: %fn",i+1,Y[i]); printf(" *** Negative data input value is not acceptable ***n"); Sleep(40000); exit(1); } } } void MessageErrorReportTEXT(){ int i; char Ql; Ql=176; printf("an "); for (i=1;i<50;i++) printf("%c",Ql); printf(" Error Report "); for (i=1;i<50;i++) printf("%c",Ql); printf("n"); } void DATA_TABLE(double X[],double Y[],int n){ int i; char Qa,Qb,Qc,Qd,Qe,Qf; int BB=201,CC=205,DD=187,EE=200,FF=188,GG=186; Qa=BB;Qb=CC;Qc=DD;Qd=EE;Qe=FF;Qf=GG; printf(" %c",Qa); for (i=1;i<45;i++) printf("%c",Qb); printf("%cn",Qc); printf(" %c X-Y Data Table %cn",Qf,Qf); printf(" %c Number X Y %cn",Qf,Qf); printf(" %c",Qd); for (i=1;i<45;i++) printf("%c",Qb); printf("%cn",Qe); for(i=0;i<n;i++) printf("t %d %.3e %.3en",i+1,X[i],Y[i]); } void OUTPUT_XML(double X[],double Y[],int n,const char SheetName[],const char TableName[],int NumCol,int NumRow,int FontSize){ FILE *OutputFile; OutputFile = fopen(ShowText02, "w");
  • 3. fprintf(OutputFile,"<?xml version="1.0"?>n"); fprintf(OutputFile,"<?mso-application progid="Excel.Sheet"?> n"); fprintf(OutputFile,"<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" n"); fprintf(OutputFile,"xmlns:o="urn:schemas-microsoft-com:office:office" n"); fprintf(OutputFile,"xmlns:x="urn:schemas-microsoft-com:office:excel" n"); fprintf(OutputFile,"xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" n"); fprintf(OutputFile,"xmlns:html="http://www.w3.org/TR/REC-html40"> n"); fprintf(OutputFile,"<DocumentProperties xmlns="urn:schemas-microsoft-com:office:office"> n"); fprintf(OutputFile,"<Author>SALAR DELAVAR GHASHGHAEI</Author> n"); fprintf(OutputFile,"<LastAuthor>Windows User</LastAuthor> n"); fprintf(OutputFile,"<Created>2019-05-27T12:20:49Z</Created> n"); fprintf(OutputFile,"<Version>15.00</Version> n"); fprintf(OutputFile,"</DocumentProperties> n"); fprintf(OutputFile,"<OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office"> n"); fprintf(OutputFile,"<AllowPNG/> n"); fprintf(OutputFile,"</OfficeDocumentSettings> n"); fprintf(OutputFile,"<ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel"> n"); fprintf(OutputFile,"<WindowHeight>7905</WindowHeight> n"); fprintf(OutputFile,"<WindowWidth>20490</WindowWidth> n"); fprintf(OutputFile,"<WindowTopX>0</WindowTopX> n"); fprintf(OutputFile,"<WindowTopY>0</WindowTopY> n"); fprintf(OutputFile,"<ProtectStructure>False</ProtectStructure> n"); fprintf(OutputFile,"<ProtectWindows>False</ProtectWindows> n"); fprintf(OutputFile,"</ExcelWorkbook> n"); fprintf(OutputFile,"<Styles> n"); fprintf(OutputFile,"<Style ss:ID="Default" ss:Name="Normal"> n"); fprintf(OutputFile,"<Alignment ss:Vertical="Bottom"/> n"); fprintf(OutputFile,"<Borders/> n"); fprintf(OutputFile,"<Font ss:FontName="Calibri" x:Family="Swiss" ss:Size="%d" ss:Color="#00FF00"/> n",FontSize);/////////// fprintf(OutputFile,"<Interior/> n"); fprintf(OutputFile,"<NumberFormat/> n"); fprintf(OutputFile,"<Protection/> n"); fprintf(OutputFile,"</Style> n"); fprintf(OutputFile,"<Style ss:ID="s73"> n"); fprintf(OutputFile,"<Alignment ss:Horizontal="Center" ss:Vertical="Center"/> n"); fprintf(OutputFile,"<Borders> n"); fprintf(OutputFile,"<Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1"/> n"); fprintf(OutputFile,"<Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1"/> n"); fprintf(OutputFile,"<Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1"/> n"); fprintf(OutputFile,"<Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1"/> n"); fprintf(OutputFile,"</Borders> n"); fprintf(OutputFile,"</Style> n"); fprintf(OutputFile,"<Style ss:ID="s74"> n"); fprintf(OutputFile,"<Alignment ss:Horizontal="Center" ss:Vertical="Center"/> n"); fprintf(OutputFile,"<Borders> n"); fprintf(OutputFile,"<Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1"/> n"); fprintf(OutputFile,"<Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1"/> n"); fprintf(OutputFile,"<Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1"/> n"); fprintf(OutputFile,"<Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1"/> n"); fprintf(OutputFile,"</Borders> n"); fprintf(OutputFile,"</Style> n");
  • 4. fprintf(OutputFile,"</Styles> n"); fprintf(OutputFile,"<Worksheet ss:Name="%s"> n",SheetName); fprintf(OutputFile,"<Table ss:ExpandedColumnCount="%d" ss:ExpandedRowCount="%d" x:FullColumns="1" n",NumCol,NumRow+1); fprintf(OutputFile,"x:FullRows="1" ss:DefaultRowHeight="15"> n"); fprintf(OutputFile,"<Row> n"); fprintf(OutputFile,"<Cell ss:MergeAcross="%d" ss:StyleID="s73"><Data ss:Type="String">%s</Data></Cell> n",NumCol-1,TableName);/// fprintf(OutputFile,"</Row> n"); for (int i=0;i<n;i++){ fprintf(OutputFile,"<Row> n"); fprintf(OutputFile,"<Cell ss:StyleID="s74"><Data ss:Type="String">%.5e</Data></Cell> n",X[i]);/// fprintf(OutputFile,"<Cell ss:StyleID="s74"><Data ss:Type="String">%.5e</Data></Cell> n",Y[i]);/// fprintf(OutputFile,"</Row> n"); } fprintf(OutputFile,"</Table> n"); fprintf(OutputFile,"<WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel"> n"); fprintf(OutputFile,"<PageSetup> n"); fprintf(OutputFile,"<Header x:Margin="0.3"/> n"); fprintf(OutputFile,"<Footer x:Margin="0.3"/> n"); fprintf(OutputFile,"<PageMargins x:Bottom="0.75" x:Left="0.7" x:Right="0.7" x:Top="0.75"/> n"); fprintf(OutputFile,"</PageSetup> n"); fprintf(OutputFile,"<Selected/> n"); fprintf(OutputFile,"<ProtectObjects>False</ProtectObjects> n"); fprintf(OutputFile,"<ProtectScenarios>False</ProtectScenarios> n"); fprintf(OutputFile,"</WorksheetOptions> n"); fprintf(OutputFile,"</Worksheet> n"); fprintf(OutputFile,"</Workbook> n"); fclose(OutputFile); }