如何使文本转到单元格的底部 [英] How do I make the text go to the bottom of the cell

查看:78
本文介绍了如何使文本转到单元格的底部的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试了许多不同的格式化方法,无论文本底部的文本太高。

I have tried many different ways of formatting and no matter what the text is too high off of the bottom of the cell.

'// FORMAT THE WORKSHEET!
        With t_WorkSheet
            '// THE TOTAL WIDTH IS THE CONSTANT...
            Dim t_Remaining As Single = m_TotalExcelWidth
            t_Remaining = m_TotalExcelWidth - ((13 * 4) + 5)

            '.Rows(2).EntireRo  w.ComlumHeight = 20
            '.Rows(2).EntireRow.VerticalAlignment = Excel.XlVAlign.xlVAlignBottom

            '.Columns.Item(PG2A_NO).Cells.VerticalAlignment = Excel.XlVAlign.xlVAlignBottom
            .Columns.Item(PG2A_NO).ColumnWidth = 5
            '.Columns.Item(PG2A_NAME).Cells.VerticalAlignment = Excel.XlVAlign.xlVAlignBottom
            .Columns.Item(PG2A_NAME).ColumnWidth = t_Remaining   '// GET REMAINING!
            .Columns.Item(PG2A_NFIP).ColumnWidth = 13
            .Columns.Item(PG2A_REP).ColumnWidth = 13
            .Columns.Item(PG2A_DEP).ColumnWidth = 13
            .Columns.Item(PG2A_INS).ColumnWidth = 13

            '.Rows(2).EntireRow.AutoFit()
            'With doc2.Tables(2).Rows
            '    .WrapAroundText = True
            '    .DistanceLeft = 20
            '    .DistanceRight = 20
            '    .DistanceTop = 20
            '    .DistanceBottom = 20
            'End With



            For x = 7 To 10
                .Columns.Item(7).Delete()
            Next
        End With

        '************************************************************************
        ' BEFORE PASTING IN EXCEL, ADD IN THE OBJECT NAME AS SectionHdr3 STYLE! *
        '************************************************************************
        '                                           USED TO BE "SectionHdr3"
        t_Doc.Application.Selection.Style = t_Doc.Styles.Item("Sect2and3Hdr")
        t_Doc.Application.Selection.TypeText(Text:="Summary of Values Schedule")
        't_Doc.Application.Selection.TypeParagraph()
        t_Doc.Application.Selection.ParagraphFormat.SpaceBefore = 0
        t_Doc.Application.Selection.ParagraphFormat.SpaceAfter = 0
        t_Doc.Application.Selection.ParagraphFormat.LineSpacing = 1
        t_Doc.Application.Selection.Style = t_Doc.Styles.Item("Normal")
        t_Doc.Application.Selection.Font.Size = 10
        t_Doc.Application.Selection.TypeParagraph()
        t_Doc.Application.Selection.Font.Name = "Arial"
        ' t_WorkSheet.UsedRange.VerticalAlignment = Excel.XlVAlign.xlVAlignCenter
        ' t_WorkSheet.UsedRange.RowHeight = 20

        't_Doc.Application.Selection.ParagraphFormat.SpaceBefore = 0
        't_Doc.Application.Selection.ParagraphFormat.SpaceAfter = 0
        ' t_Doc.Application.Selection.ParagraphFormat.LineSpacing = 1

        '// COPY THE EXCEL AND PASTE IT INTO WORD!
        t_WorkSheet.UsedRange.Copy()

        t_Doc.Application.Selection.Paste()

        '// SIZE THE NEW TABLE TO BE 7 INCEHS WIDE.
        Dim t_WordGlobal As New Word.[Global]
        Dim t_Table As Word.Table
        t_Table = t_Doc.Tables.Item(t_Doc.Tables.Count)
        Dim UsableWidth As Single
        'Dim tlPanel As TableLayoutPanel
        'Dim aRow As Word.Row

        t_Table.Rows.SetLeftIndent( _
        LeftIndent:=0, RulerStyle:=Word.WdRulerStyle.wdAdjustNone)
        With t_Doc.PageSetup
            UsableWidth = .PageWidth - .LeftMargin - .RightMargin
        End With

        

        t_Table.PreferredWidth = UsableWidth
        t_Table.AllowAutoFit = True
        t_Table.Rows.SetHeight(0.43, Word.WdRowHeightRule.wdRowHeightExactly)

      

        'For Each aRow In t_Table.Rows
        '    styles.Add(aRow)
        'Next
        'For Each style As RowStyle In styles
        '    style.SizeType = SizeType.Absolute
        '    style.Height = 180
        'Next


        With t_Table
            On Error Resume Next

            .PreferredWidth = m_7InchWidth
            .Columns.Item(PG2A_NO).Width = t_WordGlobal.InchesToPoints(0.4)
            .Columns.Item(PG2A_NO).Cells.VerticalAlignment = Word.WdCellVerticalAlignment.wdCellAlignVerticalBottom
            .Columns.Item(PG2A_NAME).Width = t_WordGlobal.InchesToPoints(2.6)
            .Columns.Item(PG2A_NAME).Cells.VerticalAlignment = Word.WdCellVerticalAlignment.wdCellAlignVerticalBottom

            .Columns.Item(PG2A_NFIP).Width = t_WordGlobal.InchesToPoints(1)
            .Columns.Item(PG2A_REP).Width = t_WordGlobal.InchesToPoints(1)
            .Columns.Item(PG2A_DEP).Width = t_WordGlobal.InchesToPoints(1)
            .Columns.Item(PG2A_INS).Width = t_WordGlobal.InchesToPoints(1)

            'If t_Table.Rows.Count > 4 Then
            '    For x = 3 To (t_Table.Rows.Count - 1)
            '        t_Table.Rows.Item(x).Height = t_WordGlobal.InchesToPoints(0.25)
            '        t_Table.Rows.Item(x).HeightRule = Word.WdRowHeightRule.wdRowHeightExactly
            '        t_Table.Rows.Item(x).Cells.VerticalAlignment = Word.WdCellVerticalAlignment.wdCellAlignVerticalCenter
            '    Next

            '    t_Table.Rows.Item(1).AllowBreakAcrossPages = False
            '    t_Table.Rows.Item(2).AllowBreakAcrossPages = False
            '    t_Table.Rows.Item(1).HeadingFormat = True
            '    t_Table.Rows.Item(2).HeadingFormat = True
            'End If

推荐答案

代码未完成



问题不明确
The code is not completed

the question is not clear


这篇关于如何使文本转到单元格的底部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆