Highlighted
Absent Member.
Absent Member.
5285 views

Export to excel

Jump to solution

Can anyone please give me an example of export to excel using Visual COBOL in asp web forms ?

0 Likes
1 Solution

Accepted Solutions
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: Export to excel

Jump to solution

I found a couple articles that show how to export the data in a Repeater to an excel spreadsheet. You could also use a manual method such as the one found here but this seems to provide a simple way of doing this,

Assuming that you have a button called ExportToExcel on your form the following code will allow you to save the data to an Excel file format in its click method:

View solution in original post

0 Likes
8 Replies
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: Export to excel

Jump to solution

Can you please be more specific? What is it that you want to export to Excel, a file, a control like a grid, create a new spreadsheet and populate it with data?

What is it that you wish to accomplish?

Thanks.

0 Likes
Highlighted
Absent Member.
Absent Member.

RE: Export to excel

Jump to solution

Hi Chris,

I want to create a new spreadsheet filled with the data, that i have populated on the screen using an asp repeater.

Thanks

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: Export to excel

Jump to solution

I found a couple articles that show how to export the data in a Repeater to an excel spreadsheet. You could also use a manual method such as the one found here but this seems to provide a simple way of doing this,

Assuming that you have a button called ExportToExcel on your form the following code will allow you to save the data to an Excel file format in its click method:

View solution in original post

0 Likes
Highlighted
Absent Member.
Absent Member.

RE: Export to excel

Jump to solution

Hello Chris,

Firstly sorry for the late reponse. I tried this but was unsuccessful in achieving it. I get COBCH0845 for StringWriter.

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: Export to excel

Jump to solution

A COBCH0845 error means that the class is not found. Since StringWriter is a .NET class you should Google the MSDN documentation to see what namespace and assembly that it resides in.

Namespace:   System.IO

Assembly:mscorlib (in mscorlib.dll)

Since StringWriter is in the System.IO namespace you need to add an ilusing"System.IO" directive in order to reference the name StringWriter without using System.IO.StringWriter.

mscorlib.dll should be referenced automatically.

0 Likes
Highlighted
Absent Member.
Absent Member.

RE: Export to excel

Jump to solution

Hello Chris,

That worked! But have got a problem now , which I was trying to fix but failed to. I am just getting an empty spreadsheet each time i do the export.

0 Likes
Highlighted
Absent Member.
Absent Member.

RE: Export to excel

Jump to solution
[deleted]
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: Export to excel

Jump to solution

Hello Yasminpriya,

Thanks for your response, but that is not exactly what i need as it is in C#.

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.