File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes XML and Related Technologies and the fly likes styling in excel sheet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "styling in excel sheet" Watch "styling in excel sheet" New topic

styling in excel sheet

sudheer sannareddy

Joined: Dec 09, 2006
Posts: 3
Hi ,
I am genearting a excel file from a XML file using XSLT. But I am not able to do any styling on that genearted file. I am following the below approach.

<?xml version="1.0" encoding="iso-8859-1" ?>

<xsl:stylesheet version="1.0"
xmlns="urn:schemas-microsoft-comffice:spreadsheet" xmlns:xsl=""
xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:user="urn:my-scripts"
xmlns:ixext="" >

<xsl:import href="../../../reportcommon.csv.xsl" />
<xslutput method="text" omit-xml-declaration="yes" encoding="iso-8859-1"/>

<xsl:template match="/">
<Workbook xmlns="urn:schemas-microsoft-comffice:spreadsheet" xmlns="urn:schemas-microsoft-comfficeffice" xmlns:x="urn:schemas-microsoft-comffice:excel" xmlns:ss="urn:schemas-microsoft-comffice:spreadsheet" xmlns:html="">
<ss:Style ss:ID="Default" ss:Name="Normal">
<ss:Font ss:Color="red"/>
<ss:Style ss:ID="xl1">
<ss:Font ss:Bold="1"/>
<xsl:apply-templates select="object" />

<xsl:template match="object">
<xsl:apply-templates select="auditReports" />
<xsl:call-template name="ama-csv-template" />


<xsl:template match="auditReports">
<xsl:variable name="is-all"><xsl:value-of select="auditValue/rowNum/node()" /></xsl:variable>
<Table x:FullColumns="1" x:FullRows="1">
<Row><Cell ss:StyleID="Default"><Data ss:Type="String">
Audit Trail Report
<xsl:apply-templates select="reportHeader">
<xsl:with-param name="is-header"><xsl:value-of select="1"/>
I want to display "Audit Trial Report" bold and colorful. For that currently we are using <Row><Cell ss:StyleID="Default">..

Please how can solve this problem.... is there any other way I can solve this ??
Thanks in advance. Waiting for your replies......
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
Maybe the best way to approach this is to create a file in Excel that contains everything you're trying to create, and then saving it in the XML format. Then you could look at it to see which parts you're missing.
sannareddy sudheer

Joined: Jul 16, 2003
Posts: 8
Thanks Ulf Dettmer , we have mistakenly put <xslutput method="text" > and we haven't given any name for the <worksheet> . after removing the <xslutput method="text" > (by default 'xml') and adding the <worksheet> name it works fine.
I agree. Here's the link:
subject: styling in excel sheet
It's not a secret anymore!