Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 315
  • Last Modified:

Values (html table displayed in excel format) not sorted numerically

Hi

I have this JSP which retrieves data from the database and formats them in html table format. The table contents are then displayed in an excel application in the browser. Users can save the excel file from the browser menu.

Is there any way to define the cell's datatype as "general" or "numeric" so that the values are sorted numerically and not alphabetically?

Thanks!
0
zapot
Asked:
zapot
  • 3
  • 3
1 Solution
 
searlasCommented:
Can you add an 'order by' clause to your database query?
0
 
zapotAuthor Commented:
It is not about the sql query. User can sort any field(s) in an excel file in any order they like.
0
 
searlasCommented:
Can you shows us the HTML you are using to achieve this; to get Excel embedded in the browser?
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
zapotAuthor Commented:
The html equivalent is
<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="application/vnd.ms-excel">

0
 
searlasCommented:
An example:

In the style declaration:
<style>
/* Declare general style */
.style0 {
      mso-number-format:General;
      text-align:general;
      vertical-align:bottom;
      white-space:nowrap;
      mso-rotate:0;
      mso-background-source:auto;
      mso-pattern:auto;
      color:windowtext;
      font-size:11.0pt;
      font-weight:400;
      font-style:normal;
      text-decoration:none;
      font-family:TuiType;
      mso-generic-font-family:auto;
      mso-font-charset:0;
      border:none;
      mso-protection:locked visible;
      mso-style-name:Normal;
      mso-style-id:0;
}

.numeric {
      mso-style-parent:style0; /* referes to style above */
      mso-number-format:Fixed; /* interpret cell as proper Number - c.f. with General above */
}
</style>

On the table cell:
<td class="numeric">12.34</td>


0
 
zapotAuthor Commented:
ok i know what is e problem. Actually there is no need to specify numeric, the datatype is "text" because the value has a trailing whitespace :)

thanks for all the help
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now