[英]Export to Excel Formatting
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. 我已经建立了一个基本的html表,在每个单元格(不要问)中都有一个读取器,可以导出到excel,我也有一个数据网格,可以导出到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, ie:
每个单元格内都有一个名称列表,即:
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?
有没有一种方法可以使每个html表格单元格中的名称位于单个Excel单元格中?
您可以尝试用引号将它们括起来,例如“ Bob Smith”。
It's probably the <br>
which is creating the sub-cells. <br>
可能正在创建子单元。 Try putting "& chr(13)" or "& vbCrLf" or even "\\r\\n" instead. 尝试放置“&chr(13)”或“&vbCrLf”甚至“ \\ r \\ n”。
Excel is a complete crapshoot when it comes to formatting stuff. 当涉及到格式化内容时,Excel是一个完整的解决方案。 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.
因此,我经常避免直接导出到excel并提供可复制并粘贴到excel中的报表视图的麻烦。
For example, I had a report which my users could click a button to view in 3 different ways: 例如,我有一个报告,我的用户可以单击一个按钮以3种不同方式查看:
<TD>
corresponds to a cell and <tr>
is a row. <TD>
对应一个单元格,而<tr>
是一行。 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. 我所做的只是编写了一种格式化方法,可以将标头前缀/后缀,行前缀/后缀,col前缀/后缀和表前缀/后缀作为参数传递。 I'd pass the appropriate params into the format method based on a GET param.
我会将适当的参数传递给基于GET参数的format方法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.