XL: Decimal Points in Accounting Format Are Not Aligned in Browser (221070)



The information in this article applies to:

  • Microsoft Excel 2000
  • Microsoft Excel 2002

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.

    -and-

  • 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.

    -or-

  • 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.

REFERENCES

For more information about how to change a number format, click Microsoft Excel Help on the Help menu, type Reset a number format in the Office Assistant or the Answer Wizard, and then click Search to view the topic.

For more information about saving a spreadsheet as an interactive Web page, click Microsoft Excel Help on the Help menu, type Put a worksheet on a Web page in the Office Assistant or the Answer Wizard, and then click Search to view the topic.

Modification Type:MajorLast Reviewed:10/7/2003
Keywords:kbprb KB221070