Excel 2002: Indents May Not Print If Fit to Page Is Combined With Print Row and Column Headings (322761)



The information in this article applies to:

  • Microsoft Excel 2002

This article was previously published under Q322761

SYMPTOMS

When you print or print preview a worksheet that contains indented cells, the indents may not be printed or displayed. This occurs if you try to set both of the following Print Setup options and you are printing to a PCL driver:
  • Print Row and Column Headings
  • Fit to number pages wide by number tall

WORKAROUND

To work around this behavior use one of the following methods:

Method 1

You can use the following macro code to replace each indent with spaces that simulate indents, and then print the worksheet:
Sub RemoveIndents()
        'Each indent places approximately 3 character widths
            ' of space at the beginning of the cell
            ' Macro tests for the indent level and
            ' replaces each indent with 3 spaces
    For Each c In ActiveSheet.UsedRange.Cells
        If c.IndentLevel > 0 Then
            padstring = String(c.IndentLevel * 3, " ")
            c.Value = padstring & c.Text
            c.IndentLevel = 0
        End If
    Next
End Sub
				
To remove the spaces and replace the indents, run this code:
Sub ReplaceIndents()
        'Macro tests for spaces at the beginning of the cells
            'and replaces each indent with 3 spaces
     Dim OldLevel As Byte 'used to hold the indentlevel you need
     For Each c In ActiveSheet.UsedRange
         If InStrRev(c.Text, " ") > 0 Then 
               OldLevel = (InStrRev(c.Text, " ") + 2) / 3
                    of the cell, divides by 3 to give indentlevel
               c.Value = Right(c.Text, Len(c.Text) - _
                 InStrRev(c.Text, " ") - 2)
               c.IndentLevel = OldLevel
          End If
     Next c
End Sub
				


Method 2

Use a PostScript printer driver to print your worksheet.

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.

Microsoft is researching this problem and will post more information in this article when the information becomes available.


Modification Type:MinorLast Reviewed:1/6/2006
Keywords:kbfix kbprb KB322761