Microsoft KB Archive/221070

From BetaArchive Wiki
Knowledge Base


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

Article ID: 221070

Article Last Modified on 1/24/2007



APPLIES TO

  • Microsoft Office Excel 2003
  • Microsoft Excel 2002 Standard Edition
  • Microsoft Excel 2000 Standard Edition



This article was previously published under Q221070

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.

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.

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.


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.


Additional query words: XL2000 xl2002 xl2003

Keywords: kbprb KB221070