16,016,894 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View .NET questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Sarath02 (Top 12 by date)
Sarath02
24-Apr-14 9:27am
View
This link is not help for me......can you explain with some example
Sarath02
24-Apr-14 9:25am
View
Here i am using xml document. i can't understand how to write the code. can you please help me....i will write my code here..just set the paths...please
Here is my c# code:
List<contact> Clist = new List<contact>();
string filename = Server.MapPath("index.xml");
XmlDocument doc = new XmlDocument();
doc.Load(filename);
XmlNode node = doc.SelectSingleNode("//test");
XmlNodeList nList = node.SelectNodes("tm/mc/cs");
foreach (XmlNode n in nList)
{
Contact con = new Contact();
con.sa1 = n.SelectSingleNode("t").InnerText;
con.sa2 = n.SelectSingleNode("mc").InnerText;
con.sa3 = n.SelectSingleNode("f").InnerText;
Clist.Add(con);
}
Sarath02
24-Apr-14 6:51am
View
These links are good related to Open XML SDK. But here my problem is create spreadsheet using xml file.
Ex: Here I have index.xml file, By using this xml file i want to create a spreadsheet
Sarath02
23-Apr-14 12:03pm
View
When i am creating a spreadsheet using following code. that will not created. even it is not showing any error also.
Along with that, i want to show some data when creating spreadsheet.
Ex: I want to show what is your name in spreadsheet.
Here is my code:
protected void Page_Load(object sender, EventArgs e)
{
string filename = @"c:/Users/Public/Documents/MySheet.xlsx";
CreateSpreadsheetWorkbook(filename);
}
public static void CreateSpreadsheetWorkbook(string filepath)
{
// Create a spreadsheet document by supplying the filepath.
// By default, AutoSave = true, Editable = true, and Type = xlsx.
SpreadsheetDocument spreadsheetDocument = SpreadsheetDocument.
Create(filepath, SpreadsheetDocumentType.Workbook);
// Add a WorkbookPart to the document.
WorkbookPart workbookpart = spreadsheetDocument.AddWorkbookPart();
workbookpart.Workbook = new Workbook();
// Add a WorksheetPart to the WorkbookPart.
WorksheetPart worksheetPart = workbookpart.AddNewPart<worksheetpart>();
worksheetPart.Worksheet = new Worksheet(new SheetData());
// Add Sheets to the Workbook.
Sheets sheets = spreadsheetDocument.WorkbookPart.Workbook.
AppendChild<sheets>(new Sheets());
// Append a new worksheet and associate it with the workbook.
Sheet sheet = new Sheet()
{
Id = spreadsheetDocument.WorkbookPart.
GetIdOfPart(worksheetPart),
SheetId = 1,
Name = "mySheet"
};
sheets.Append(sheet);
workbookpart.Workbook.Save();
// Close the document.
spreadsheetDocument.Close();
}
Sarath02
23-Apr-14 10:42am
View
ya ok sorry for that...Here i will explain clearly now....
I want to show what is your name in spreadsheet. than how can i show that can you explain
Sarath02
23-Apr-14 10:20am
View
For that reason i am asking the code josh. why i am not getting the output i will not understand. so, can you please help e now....For creating spreadsheet using xml file with Open XML SDK.
Sarath02
23-Apr-14 10:18am
View
After running the project it will show empty page....and it will not show any error..see below link once
http://www.evernote.com/shard/s419/sh/e70ebb6c-c33c-4556-b182-163376cae659/6f7b7ac2628864531a3fd467b8ce604f
Sarath02
23-Apr-14 10:10am
View
okay josh...Here is my code...
protected void Page_Load(object sender, EventArgs e)
{
String fileName = @"C:\Users\Public\Documents\ExcelData.xlsx";
// Comment one of the following lines to test the method separately.
ReadExcelFileDOM(fileName); // DOM
ReadExcelFileSAX(fileName); // SAX
}
static void ReadExcelFileDOM(string fileName)
{
using (SpreadsheetDocument spreadsheetDocument = SpreadsheetDocument.Open(fileName, false))
{
WorkbookPart workbookPart = spreadsheetDocument.WorkbookPart;
WorksheetPart worksheetPart = workbookPart.WorksheetParts.First();
SheetData sheetData = worksheetPart.Worksheet.Elements<sheetdata>().First();
string text;
foreach (Row r in sheetData.Elements<row>())
{
foreach (Cell c in r.Elements<cell>())
{
text = c.CellValue.Text;
Console.Write(text + " ");
}
}
Console.WriteLine();
//Console.ReadKey();
}
}
// The SAX approach.
static void ReadExcelFileSAX(string fileName)
{
using (SpreadsheetDocument spreadsheetDocument = SpreadsheetDocument.Open(fileName, false))
{
WorkbookPart workbookPart = spreadsheetDocument.WorkbookPart;
WorksheetPart worksheetPart = workbookPart.WorksheetParts.First();
OpenXmlReader reader = OpenXmlReader.Create(worksheetPart);
string text;
while (reader.Read())
{
if (reader.ElementType == typeof(CellValue))
{
text = reader.GetText();
Console.Write(text + " ");
}
}
Console.WriteLine();
//Console.ReadKey();
}
}
Sarath02
23-Apr-14 9:56am
View
i have xml files in my project. by using this xml file i want to create spreadsheet. i want code. Here it is not possible for posting the total code. so, can you please write some code for me related to that topic.
Sarath02
23-Apr-14 9:24am
View
Here i want to create a spreadsheet using xml file.
Sarath02
21-Apr-14 10:05am
View
No, i am asking articles on that topic.
Sarath02
21-Apr-14 8:00am
View
yes....
Show More