English 中文(简体)
显示标签用超文本页格式向外加出口
原标题:Display tag export to excel with the css formatting of the HTML page

我在我们的网络应用中使用显示器。 我成功地出口了显示标记显示的数据,以挖掘。

问题在于,我也希望把头盔和数据浏览风格和 c列入出口前线。

e.g. Header row is bold with gray background and columns in data rows are colored depending on the value.

但是,这并没有被出口到外部。

<><><><>>>

Below is the display tag code in my JSP. The list is shown properly with all the css applied to headers and data rows properly.

我还可将数据输出到前线。

<display:table name="userList"  pagesize="20"  class="listingTable" keepStatus="true" 
cellpadding="0px"  cellspacing="0px"  id="user" export= true  requestURI="">
<display:setProperty name="export.decorated" value="true" />
<display:setProperty name="export.excel.filename" value="User List.xls" />
<display:column titleKey="user.firstname" property="firstname"></display:column>
<display:column titleKey="user.lastname" property="lastname"></display:column>
<display:column titleKey="user.email" property="email"></display:column>
<display:setProperty name="paging.banner.item_name" value="User" />
<display:setProperty name="paging.banner.items_name" value="Users" />

我正在使用缺省示意图,稍作改动。

请提供帮助。

问题回答

CSS 必须对需要捆绑的每个要素直接采用风格。 因此,对于具有灰色背景的大胆头行,你需要以下几个方面:

(或取代th <>/code>,使用theadthead tr

显示器还使用某些类别,用于奇/偶发、分类的浏览器和其他几个类别。 详情见。

此外,Excel只能使用56种不同的颜色,因此,如果你想有真的肤色或背景,你必须使用Excel能够接受的颜色。 见第条,涵盖面色谱。

这里是一份可接受的颜色清单: 马达加斯加

出口一张带有打字信息的超文本表格,你不能使用CSS的平级方法。 相反,在每种需要以某种方式编排的超文本标签中,你都增加了字体参数。 表格罗的使用方式实例

从我最近的学习中,我的理解是:。 显示标签不能直接出口以超文本形式使用的标签。 您必须按项目编排格式和打字。

我采取了一种做法,我是成功的。

The procedure is:
you will need to create a class to replace the default export view class of the display tag as like ExcelHssfView or DefaultHssfExportView

you can do this by implementing ExportView interface as display tag documentation says:
Any valid class that implements the org.displaytag.export.ExportView interface.

But i implemented BinaryExportView interface as it extends ExportView so its all the same. Truly speaking i just copied all the code from the source of ExcelHssfView and edited only the doExport method. if you look into the source you will understand what will you have to do. hints :use HSSFCellStyle to give any style to the excel file

http://www.un.org/Depts/DGACM/index_french.htm

See example of a ExportView:





相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

jquery ui dialog opens only once

I have a button that opens a dialog when clicked. The dialog displays a div that was hidden After I close the dialog by clicking the X icon, the dialog can t be opened again.

Drop down background url in Safari Issue

selectBox.selectCSS { background: url(/Images/replacementSelectBackground.png) top left no-repeat height:auto; } I have an issue in Safari only where the image is not rendering on top ...

CSS specific for Safari

How do you target specifically safari in css with styles?

Aligning textarea in a form

Ive used the following css code to align my form elements: form { position:relative; } form input { position:absolute; left:11em; } However, the textarea element is not aligned correctly with the ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

CSS problem with page footer

I have defined my page footer in the css file as: #footer { position: absolute; height: 50px; text-align: center; background: #66CCCC; bottom: 0px; left: 0px; width: 100%; height: ...