Reputation: 453
I have set up a basic html table with a reader in each cell (don't ask) that exports to excel, I also have a datagrid that exports to excel. Both work without issue in regards to actually creating the spreadsheet, but I have a question regarding formatting. Inside each cell is a list of names, i.e.:
Bob Smith Jim Bob John Miller Susie Q Jane Doe
When the spreadsheet comes up it places each name in a separate "sub cell" instead of having it all in one cell. Is there a way I can make it so that the names in each html table cell are in a single Excel cell?
Upvotes: 0
Views: 1070
Reputation: 16516
It's probably the <br>
which is creating the sub-cells. Try putting "& chr(13)" or "& vbCrLf" or even "\r\n" instead.
Excel is a complete crapshoot when it comes to formatting stuff. So, I often avoid the headache of exporting directly to excel and providing a view of the report which is copy and pastable into excel instead.
For example, I had a report which my users could click a button to view in 3 different ways:
<TD>
corresponds to a cell and <tr>
is a row.All i did was write a format method which I could pass in as parameters what the header prefix/suffix, row prefix/suffix, col prefix/suffix, and table prefix/suffix. I'd pass the appropriate params into the format method based on a GET param.
Upvotes: 1