.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Problems in Exporting to Excel 2007

Posted By:      Posted Date: October 27, 2010    Points: 0   Category :ASP.Net

When I export a GridView to Excel 2007 I get an error message:

 The file you are trying to open < > is in a different format than specified by the file extension.  Verify that the file is not corrupted and is from a trusted source before opening the file.  Do you want to open the file now?

 This worked OK with Excel 2003.  I called Microsoft and they told me I was using a non-release version which is not true.  My Office 2007 was downloaded from MSDN in Dec 2006.  I found a reference on the Internet that said this problem would be fixed in the released version but it is not.



View Complete Post

More Related Resource Links

Exporting MOSS 2007 List to Excel 2007

When doing the export, the columns "Item Type" and "Path" are automatically displayed in the sheet.  Is there anyway to suppress these fields from exporting automatically?  I'm sure this has already been asked before, but I couldn't find anything after much searching (perhaps I'm using the wrong keywords).  Any help would be greatly appreciated.

Has anybody experienced problems opening 'protected Excel 2007 worksheets in SPS 2003?


I have added the doc icons and MIME types to my SPS2003 farm and now it works properly with Office2007 documents, with the exception of 'protected' Excel files.  In those cases where the Excel file contains a 'protected' worksheet, the user can open the doc, unprotect the worksheet and make their edits.  When they 'protect' the worksheet again and try to save the file, they get an alert that the destination file is 'read-only' and they must save it with a different name.

This only happens for 'protected' Excel 2007 docs residing on an SPS2003 site.  Protected Excel 2003 documents work fine, as do unprotected documents.  Any help y'all can be is greatly appreciated.  I only have two users who are using the protected worksheets, but they are the most vocal of my users.

exporting to excel 2007


hello champs

i want to export the datatable to excel 2007

i did it in 2003 version.but it is not working for me in case of 2007

i tried Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"

but with no success.

any help... 

While Importing Excel 2007 file to Datatable - headerrow problem


Hi there,


I am trying to simply extract an excel data from an uploaded file an put it into a datatable. In this case the excel file has 3 rows but when I fill the datatable I only see row count of 2.

I tried changing HDR:NO; to HDR:YES and vice versa, but no luck. 

What am I doing wrong? (Note: the excel file cannot have a  headerrow)


string connstr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + pFilePath + ";Extended Properties=\"Excel 12.0;IMEX=1;HDR:NO;\"";
            OleDbConnection conn = new OleDbConnection(connstr);
            DataTable dtTables = conn.GetOleDbSchemaTable(System.Data.OleDb.OleDbSchemaGuid.Tables, null);
            string strTablename = dtTables.Rows[0]["TABLE_NAME"].ToString();
            string strSQL = "SELECT * FROM [" + strTablename + "]";

            OleDbCommand cmd = new OleDbCommand(strSQL, conn);

            DataTable dt = new DataTable();
            OleDbDataAdapter da = new OleDbDataAdapter(cmd);
            //At this point row count=2 which doesn't make sense




Excel 2007




I want to develop an application which supports Server Side Excel Automation using a template(xltx). I am able to acheive most of the automation except(using excelpackage.dll - OfficeOpenXml), i am stuck up identifying the checkbox controls in my excel work sheet.

Any help on this is really appreciated.


My sample code.




display data in excel 2007


 I am using .net  version 1.1  and  excel 2003 to display data.I need to display data in 2007 .Can  anyone suggest the reference to be added ,connection string change and what should be imported.  

Importing Excel 2007 spreadsheet into WSS 3.0 -- Error Message



I'm trying to import (Custom Lists >> Import Spreadsheet) into WSS 3.0 and I'm getting the following message: 

Refers to the _layouts

You are not authorized to view this page.  You might not have permissions to view this direcotyr or page using the credentials you supplied. [More stuff here.]

Http ERror 403 - Forbidden

Is this just a permissions problem or is there some other underlying issue?  Should you be able to upload an Excel spreadsheet (with links) into a Custom List?


Thanks! Patti N.

In sharepoint excel working fine in office 2007 but not in office 2010


Hi All,

we receive error  while trying to create excel sheet using the template we have uploaded on the SharePoint 2007.


This occurs on a machine that has Office 2010 installed. Earlier the machine had Office 2007 and everything was working fine.


Can you let me know why is problem is coming and how to resolve this.



Sanjeev Tiwari


Exporting web from MOSS 2007 to WSS 3.0

Hi! I'm trying to export SharePoint web site from MOSS 2007 to WSS 3.0.

There are some problems, which prevent me. WSS doesn't include two features: DataConnectionLibruary and TransMgmtLib. This features are not avaible on WSS, so I tried to deactivate these features using site capabilities. It wo'nt help. Here is the exception text:

Could not find Feature TransMgmtLib
at Microsoft.SharePoint.Deployment.ImportRequirementsManager.VerifyFeatureDefinition(SPRequirementObject reqObj)
at Microsoft.SharePoint.Deployment.ImportRequirementsManager.Validate(SPRequirementObject reqObj)\
at Microsoft.SharePoint.Deployment.ImportRequirementsManager.DeserializeAndValidate()
at Microsoft.SharePoint.Deployment.SPImport.VerifyRequirements()
at Microsoft.SharePoint.Deployment.SPImport.Run()
at InfoCenter.ConsoleTestingApp.Program.ImportInfoCenter()

The question is: which way must I go to solve this problem? Is it really possible (I mean export from MOSS to WSS)? And what is the purpose of TransMgmtLib feature? Thanks.

SSRS 2008 R2 and sharepoint 2007 report builder problems


I upgraded our enterprise sql server 2008 to sql server 2008 r2 last weekend.  Along with this i installed the report builder 3.0 on the servers as well and the updated ssrs add in for sharepoint.  The upgrade went fine, no errors that i could find.  The problem is now when i go to a library that has the report builder content type enabled and click report builder report under new it does not load report builder 3.0.

I updated the custom report builder url in central administration from /_vti_bin/ReportBuilder/ReportBuilder_2_0_0_0.application to /_vti_bin/ReportBuilder/ReportBuilder_3_0_0_0.application

however when i do click the new report builder report it kicks me over to http://company.com/ReportServer_MossEnt  which itemizes out each individual sharepoint site in the farm.

Is the integration of ssrs 2008 r2, sharepoint 2007 and report builder 3.0 work?  did i install the wrong version of the report builder add in?  The above is the only problem i am having now.

all servers are server 2008, 64 bit and moss 2007 enterprise with sp2 & april 2010 cu

Sharepoint 2007 and Excel 2010 features


Does Sharepoint 2007 Server support the new Excel 2010 feaures like slicers? Or do i have to have Sharepoint 2010 to get that working (considering all other components besides Sharepoint 2010 are available in my Sharepoint 2007 environment) ?

- Thanks



Video: Connecting PivotTables in Excel 2007 to Data Stored in SharePoint Lists

Learn how to use the Open XML SDK 2.0 to create Excel 2007 PivotTables that are connected to data stored in SharePoint lists.

Interacting with the Excel Web Services API for SharePoint Server 2007

Get a quick start with the Excel Web Services API, which enables interaction with published Excel 2007 workbooks in SharePoint Server 2007 from a remote application. Learn considerations around session state, security, and performance.

Publishing Excel 2007 Workbooks to SharePoint Server 2007 (Visual How To)

Watch the video and explore code as you learn how to publish Excel 2007 Workbooks to SharePoint Server 2007 programmatically.

Sample: Publishing Excel 2007 Workbooks to SharePoint Server 2007

Explore the code in this visual how-to article as you learn how to publish Excel 2007 Workbooks to SharePoint Server 2007 programmatically.

Linked Server to access Excel 2007



I'm tried SELECT * INTO XXX FROM OPENROWSET alongwith Microsoft.ACE.OLEDB.12.0.

Apparently the query requires the sql account to have SYSADMIN privileges.

Considering that SYSADMIN should not be provided to a database account on a Production Server, I tried using the Linked Server method.

Following is my code.

Exec sp_addlinkedserver 'AB2','Ace 12.0','Microsoft.ACE.OLEDB.12.0','\\\sagarr\Test1\cpc\c2\AB2.xlsx',NULL,'Excel 12.0;IMEX=1'
Exec sp_addlinkedsrvlogin 'AB2','false',NULL,NULL,NULL
Exec sp_dropserver 'AB2','droplogins'

Now i get the following error

Error.15247-User does not have permission to perform this action

My Excel file, Database and Windows Application run on separate machines.

i have provided the following privileges


EXEC sp_configure 'show advanced options', 1
EXEC sp_configure 'ad hoc distributed queries', 1

The DisAllowAdHocProcess in
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend