16,022,205 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 Pavankumar s k (Top 12 by date)
Pavankumar s k
10-Sep-13 23:35pm
View
#Region "Excel Download"
'''
''' Generate an excel file with data in GridView control
'''
''' <param name="datatable">DataTable object</param>
''' <param name="filepath">The Path of exported excel file</param>
Public Sub ExportToExcel(ByVal datatable As DataTable, ByVal filepath As String, ByVal sheetname1 As String)
' Initialize an instance of SpreadSheet Document
Try
sheetname = sheetname1
Using _spreadsheetDocument As SpreadsheetDocument = SpreadsheetDocument.Create(filepath, SpreadsheetDocumentType.Workbook)
CreateExcelFile(_spreadsheetDocument, datatable)
End Using
Catch ex As Exception
MsgBox("SuffixCode export to excel error, " & ex.Message)
End Try
End Sub
'''
''' Create SpreadSheet Document and Fill datas
'''
''' <param name="spreadsheetdoc">SpreadSheet Document</param>
''' <param name="table">DataTable Object</param>
Private Sub CreateExcelFile(ByRef spreadsheetdoc As SpreadsheetDocument, ByVal table As DataTable)
' Initialize an instance of WorkbookPart
Try
Dim workBookPart As WorkbookPart = spreadsheetdoc.AddWorkbookPart()
' Create WorkBook
CreateWorkBookPart(workBookPart)
' Add WorkSheetPart into WorkBook
Dim worksheetPart1 As WorksheetPart = workBookPart.AddNewPart(Of WorksheetPart)("rId1")
CreateWorkSheetPart(worksheetPart1, table)
' Add SharedStringTable Part into WorkBook
Dim sharedStringTablePart As SharedStringTablePart = workBookPart.AddNewPart(Of SharedStringTablePart)("rId2")
CreateSharedStringTablePart(sharedStringTablePart, table)
' Add WorkbookStyles Part into Workbook
Dim workbookStylesPart As WorkbookStylesPart = workBookPart.AddNewPart(Of WorkbookStylesPart)("rId3")
CreateWorkBookStylesPart(workbookStylesPart)
' Save workbook
workBookPart.Workbook.Save()
Catch ex As Exception
'MsgBox("Error in calling CreateExcelFile foe
End Try
End Sub
'''
''' Create an Workbook instance and add its children
'''
''' <param name="workbookPart">WorkbookPart Object</param>
Private Sub CreateWorkBookPart(ByRef workbookPart As WorkbookPart)
Dim workbook As New Workbook()
Dim sheets As New Sheets()
' Initilize an instance of Sheet Object
Dim sheet1 As New Sheet() With { _
.Name = sheetname, _
.SheetId = Convert.ToUInt32(1), _
.Id = "rId1" _
}
' Add the sheet into sheets collection
sheets.Append(sheet1)
Dim calculationProperties1 As New CalculationProperties() With { _
.CalculationId = Convert.ToUInt32(111222) _
}
' Add elements into workbook
workbook.Append(sheets)
workbook.Append(calculationProperties1)
workbookPart.Workbook = workbook
End Sub
'''
''' Generates content of worksheetPart
'''
''' <param name="worksheetPart">WorksheetPart Object</param>
''' <param name="table">DataTable Object</param>
Private Sub CreateWorkSheetPart(ByRef worksheetPart As WorksheetPart, ByVal table As DataTable)
' Initialize worksheet and set the properties
Try
Dim worksheet1 As New Worksheet() With { _
.MCAttributes = New MarkupCompatibilityAttributes() With { _
.Ignorable = "x14ac" _
} _
}
worksheet1.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships")
worksheet1.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006")
Pavankumar s k
8-Jan-13 0:52am
View
thanks
Pavankumar s k
7-Jan-13 0:05am
View
thanks for replay can you guide me for any other way
Pavankumar s k
1-Jan-13 4:01am
View
I have tried it but it is not working can you provide any other ways
Pavankumar s k
19-Jul-12 5:58am
View
Flash with asp.net in 3.5 frame work
Pavankumar s k
19-Jul-12 5:57am
View
I want steps to integrate the Flash code I do not have any idea
Pavankumar s k
19-Jul-12 5:28am
View
Steps to use flash with asp.net demo for webcam image capture please help me very urgent
Pavankumar s k
18-Jul-12 6:31am
View
Ok Thanks for replay
Pavankumar s k
18-Jul-12 5:56am
View
Yes the same article have you used it .If yes please help me
Pavankumar s k
18-Jul-12 5:45am
View
Deleted
Function are used to perform repeated operation in a project once it has written can be called for many times there are different types of function
Pavankumar s k
18-Jul-12 5:42am
View
Please Can any one help in capture image or provide an hint or else send any sample code
Pavankumar s k
18-Jul-12 5:30am
View
Can you suggest the way to work for webcam image capture with asp.net in C#
Show More