vb 如何使数据对齐

来源:百度知道 编辑:UC知道 时间:2024/06/17 03:59:11
我输出数据用的是vb中的richtextbox控件,如何是下列数据对齐呢???(只是其中一部分)

0 0 952.6 1474.3 -460.73
1 10 950.39 1474.3 -460.73
2 20 948.18 1474.3 -460.73
3 30 945.97 1474.3 -460.73
4 40 943.76 1474.3 -460.73
5 50 941.55 1474.3 -460.73
6 60 939.34 1474.3 -460.73
7 70 937.13 1474.3 -460.73
数据采用的是一维数组,每列为一个数组,数据长度可以确定,采用什么函数设置数据长度啊,请高手赐教。

1、加载管理模块
2、传值给Excel
给个实例:
Private Function ExportDetail(strFileName As String) As Boolean

Dim iRow As Long
Dim myExcel As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet

On Error GoTo ErrAction
ExportDetail = False

Set myExcel = New Excel.Application
myExcel.Visible = False
myExcel.SheetsInNewWorkbook = 1
Set xlBook = myExcel.Workbooks.Add
Set xlSheet = xlBook.Worksheets(1)

xlSheet.Columns.ClearFormats
xlSheet.Cells(1, 1) = "物料BOM【" & TreeFile.SelectedItem.Text & "】"
xlSheet.Range("A1:T1").MergeCells = True

xlSheet.Cells(2, 1) = "标题项"
xlSheet.Cells(2, 2) = "中文名称"
xlSheet.Cells(2, 3) = "英文名称"
xlSheet.Cells(2, 4) = "文档号"
xlSheet.Cells(2, 5) = "物料号"
xlSheet.Cells(2, 6) = "数量"
xlSheet.Cells(2, 7) =