excel

From SQL Server, how can I export to Excel with the column headers?

I have a query that has approx 20 columns and I would like to export this to an Excel file with the column headers. I thought this would be easy to figure out but no luck! I searched the web and found one suggestion that did not end up working so I am stuck. Anyone have any working ideas? Thanks, ...

VB/VBA: Fetch HTML string from clipboard (copied via web browser)

It seems that when you copy something from a web browser to the clipboard, at least 2 things are stored: Plain text HTML source code Then it is up to the software that you are pasting into can determine which one it wants. When pasting into MS Excel 2003, you have a paste special option to paste HTML, which will paste the formatted...

How do you create an Excel worksheet through VB6 without the Excel Object?

I was recently put in charge of updating a VB6 data collection app, to add the ability to generate Excel reports and print them through the app (both have to be done on same computer). Normally this wouldn't be an issue, I've generated Excel reports with VB6 before using the Excel Object. So I went ahead and coded together the changes a...

Deploying a Visual Studio Excel 2007 Template

I've created a project of type "Excel 2007 Template" in Visual Studio 2008, and I've deployed the project to a network share. After I run the Studio-generated setup.exe, what do I do to open the template? Is there supposed to an entry in the Start Menu? Show up in Excel somewhere? ...

Save IList<T> or IQueryable<T> to Excel - C#

I'm generating a report via Linq to SQL and displaying it on the website. I need to save the report in MS Excel (or .csv) and email it to user. Any ideas on how to save it as Excel or .csv ? .NET 3.5 / C# EDIT: the Gridview hack works perfect. If you use AJAX on the page, make sure you add a PostBaseTrigger to your Update Panel to...

SheetBeforeDoubleClick not working from COM Addin

I'm trying to write a COM add in for Excel in C# that disables the ability to double click a cell and then edit it, I want to popup a box saying that editing a cell this way is prohibited and then stop all execution. Looking through the documentation at Microsoft this seems like a very easy task, you create an Application event AppEvent...

how to create and download excel document using asp.net

How to create and download excel document using asp.net ? The purpose is to use xml, linq or whatever to send an excel document to a customer via a browser. Edit : Use case The customer load a gridview ( made with ajax framework ) in a browser, the gridview is directly linked to an sql database. I put a button 'export to excel' to let...

number field turned out as text in excel , SSRS

Hi, My SSRS reports one of the field is using this expression , where the field is a number field. I want to see blank field is the value is 0. =IIf(Fields!PERIOD02_VALUE.Value <> 0,Fields!PERIOD02_VALUE.Value ,"") the excel exported version is having this field considered as text not number. Is there any other way to do this from ...

Open an Excel 2003 spreadsheet with C#. Could not find installable ISAM. Exception

I need to pull data from an xls, I also need have the user be able to change the location of the file it will. So an OleDbConnection seemed like a good start, and it was until the first merged cell. This works for all but the merged cells: OleDbCommand cmd = new OleDbCommand(); cmd.Connection = new OleDbConnection(@"Provider=Microsoft....

What is Excel 2007 workbook Name size limit? Why?

Workbook names in Excel 2007 are supposed to be limited in size only by memory, but this appears not to be the case. Eventually, an array saved to a name will get big enough that when you try to save you get (paraphrased): "one or more of the formulas in this workbook is larger than the 8192 character limit, please save as binary file"....

Excel Interop: Range.FormatConditions.Add throws MissingMethodException

I am writing an application which uses the Microsoft.Office.Interop.Excel assembly to export/import data from Excel spreadsheets. Everything was going fine (except for 1 based indexing and all those optional parameters!), until I tried to use conditional formatting. When I call Range.FormatConditions.Add I get a MissingMethodException ...

Import a fixed width text into Excel 2003 using VB

Hello. I have a fixed width text file and I want to automatically import certain spaces in each line into specific cells of an Excel 2003 sheet. Can you help me? I will re-phrase my question because the previous one wasn't very clear. I need to read specific characters (i.e. 12-17, 23-29) and place them inside a excel sheet. Is this po...

Getting pywin32 excelAddin.py working on Excel 2007

I'm trying get pywin32 excelAddin.py demo script on winXP MS Office Excel 2007, python 2.5.4. Though the Com add-in registers itself succesfully and is displayed in "com add-ins" list in Excel, it does not work. Only error feedback i get is on the "Load behaviour" line in excel's "com add-ins" dialog, says "Not loaded. A runtime error ...

Excel + VBA: changing right click menu when clicking above autoshapes.

I am doing a little Excel + vba application and I have got stuck. I know that using Application.CommandBars("Cell").Controls.* I can change right click menu to only show specific options for specific cell (of course with additional code). But is there a way to change the menu when I click right mouse button above autoshape? I hav...

What is the best way to detect if Excel 2003 is installed?

I'm using Wix v3.0 (which boils down to an MSI installer) and I'm trying to author a condition to ensure that Excel 2003 is installed. What is the best (most robust) way to detect the presence of Excel 2003 on a machine? I've seen lots of different suggestions, but no definitive or authoritative answer. ...

Excel formula to determine cell ID when a series of numbers turns negative

Sample data A B 1 Date Amount 2 Apr 1 $6,000 3 May 1 $4,250 4 June 1 $2,750 5 July 1 $1,000 6 Aug 1 -$0.075 <- This Cell/Row 7 Sept 1 -$0.2500 In a column of numbers (in reality 100-200 rows), when the value changes to negative, e.g. if these we're amounts owed on a l...

Autofiltered List; cross-row formula

I have a large Autofiltered list (~600 rows), with some of the rows being summary rows that I want to use a UDF to display the lowest priority listed in any of the 'child' cells. I can pass to my formula the right cells, but they are no longer correct if the list is re-ordered in any way. Is there a way to give the formula the right cell...

Asp.NET Excel spreadsheet generation results in "different file format than extension error" when opening in excel, but the spreadsheet shows correctly

I am generating a spreadsheet in Asp.Net, using the following code, but am getting the error "The file you are trying to open, "Spreadsheet.aspx-18.xls', is in a different format than specified by the file extension. Verify ...". However, when I open the file it displays just fine. I am using Excel 2007. Firefox identifies the file as an...

XSD: Adding attributes to strongly-typed "simple" elements

Is there some sensible way to have elements with strongly-typed simple-types and also attributes? Okay, I have an XSD schema which has a million (er, hundred) elements that might look like this: <xsd:element name="DocumentDescription" type="xsd:string" /> <xsd:element name="DocumentDateTime" type="xsd:dateTime" /> <xsd:element name="Do...

excel macro to change unformatted text data to correctly-typed data

I'm populating an excel sheet from DTS, but the resulting output is formatted as text since DTS sees the cells as varchar(255). I'm planning on adding a macro that will format the values correctly as numeric or datetime. What VBA would I use for this? eg the value in a cell shows as "2009-01-01 00:00:00". If I press F2 to edit the cell,...