I’m trying to use Einhugur ExcelWriter to write a Recordset to Excel procedure.
I can’t seem to find a way to set the data type for each column? Is there a property that I just haven’t found?
I’m trying to use Einhugur ExcelWriter to write a Recordset to Excel procedure.
I can’t seem to find a way to set the data type for each column? Is there a property that I just haven’t found?
have you tried just setting the presentation format - not the data type ?
That appears to be to format each cell.
I was looking for something like when you click on a column in excel, you can set it to text, number, date etc.
I have to admit I did not see a column level setting for the format
Closest I can see to “setting a type” is th worksheet methods CellNumericValue, CellFormula, CellDateValue, etc
Each of those can use a specific format object but I dont know if that amounts to what it is youre seeking to set the style for an entire column
Si this is in a web app, how do I make it auto download.
In the version that I did that created csv file I just
WebFile.Data = TheCsvString
Then did ShowUrl
How do I do that with ExcelWriter?
Thanks for all the help!!!
I did this by writing to a temporary file:
[code]Dim f As FolderItem
f = GetTemporaryFolderItem
If f = Nil Then Return
Dim writer As ExcelWriterWorkbook = ExcelWriterWorkbook.Create(f, ZStream.GetZipEngineHandle)[/code]
then read this temp File into a memoryblock
[code]Dim xlsStream As BinaryStream = BinaryStream.Open(f, False)
Dim xlsbuffer As MemoryBlock
xlsbuffer = xlsStream.Read(xlsStream.Length)
xlsStream.close
Dim xlsfile As New WebFile
xlsfile.Filename = “Export.xlsx”
xlsfile.MIMEType = “application/vnd.openxmlformats-officedocument.spreadsheetml.sheet”
xlsfile.Data = xlsbuffer
xlsfile.ForceDownload = True[/code]
Thanks, almost there.
Getting IOException error 2 on:
Dim xlsStream As BinaryStream = BinaryStream.Open(f, False)
Ah sorry, I think the problem is that you have to close the ExcelWriter before the second code block:
That was it! Thanks