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.

Indents may not print if Fit to Page is combined with Print Row and Column Headings


View products that this article applies to.

This article was previously published under Q322761

↑ Back to the top


Symptoms

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

↑ Back to the top


Workaround

To work around this problem, 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.

↑ Back to the top


Status

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

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

↑ Back to the top


Keywords: KB322761, kbprb, kbfix

↑ Back to the top

Article Info
Article ID : 322761
Revision : 2
Created on : 6/4/2007
Published on : 6/4/2007
Exists online : False
Views : 329