Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

Decimal points in Accounting format are not aligned in browser in Excel


View products that this article applies to.

This article was previously published under Q221070

↑ Back to the top


Symptoms

When you save a file as Hypertext Markup Language (HTML) and view it in a Web browser, numbers formatted with currency symbols may not have their decimal points lined up correctly. In Excel, the decimal points are lined up correctly.

↑ Back to the top


Cause

This problem may occur if all of the following conditions are true:
  • You format the numbers with the Accounting format, which aligns the currency symbol on the left and the number portion on the right of each cell.
  • You save the file as a static or noninteractive HTML file.
This problem occurs because HTML has no method to both left align and right align text in the same cell.

↑ Back to the top


Workaround

To work around this problem, use either of the following methods:
  • Use the Currency number format instead of Accounting. The Currency format aligns the numbers to the right without aligning the currency symbols.
  • Publish the file as a Web page with interactivity.
To publish a file as a Web page with interactivity, follow these steps:
  1. Open the worksheet you want to put on a Web page.
  2. On the File menu, click Save as Web Page.
  3. In the Save As dialog box, click Publish.
  4. In the Publish as Web Page dialog box, under Viewing options, click to select the Add interactivity with check box.
  5. If you want to view the Web page in your browser after you publish it, click to select the Open published web page in browser check box.
  6. Click Publish.

↑ Back to the top


More information

When you use the Accounting format, Microsoft Excel aligns decimal points. Excel first draws the number as right-aligned, and then draws the currency symbol and spaces as left-aligned. In this way, both the currency symbols and decimal points are aligned vertically. There is no way in HTML to have the browser do the same thing. In a browser, numbers with Accounting format are left aligned, and because the width of space characters is not always the same as the width of digits, decimal places may be misaligned.

This is not a problem when you publish with interactivity, because the browser uses the Microsoft Office Spreadsheet Component, which is able to format and display the Accounting format in the same way as the spreadsheet.

↑ Back to the top


Keywords: KB221070, kbprb

↑ Back to the top

Article Info
Article ID : 221070
Revision : 5
Created on : 1/24/2007
Published on : 1/24/2007
Exists online : False
Views : 241