本帖最后由 骗子 于 2014-5-30 22:03 编辑
笨办法,结果应该和你的图完全一样了
#include <Array.au3>
$txt = StringRegExpReplace(FileRead('p.txt'), '\h+', '|')
$array = StringRegExp($txt, '\V+', 3)
For $i = UBound($array) - 1 To 0 Step -1
$array[$i] = StringTrimLeft($array[$i], 1)
$array[$i] = StringRegExpReplace($array[$i], '订\|货\|单', '订货单')
$array[$i] = StringRegExpReplace($array[$i], '金\|额', '金额')
If StringInStr($array[$i], '________') Or StringInStr($array[$i], '=====') Or $array[$i] = '|' Then _ArrayDelete($array, $i)
Next
Dim $temp[UBound($array)][10]
For $i = 0 To UBound($array) - 1
$ta = StringSplit($array[$i], '|', 2)
For $j = 0 To UBound($ta) - 1
$temp[$i][$j] = $ta[$j]
Next
If UBound($ta) = 6 Then
For $j = 0 To 9
$temp[$i][$j] = ''
Next
For $j = 0 To 3
$temp[$i][$j] = $ta[$j]
Next
$temp[$i][5] = $ta[4]
$temp[$i][7] = $ta[5]
EndIf
If UBound($ta) = 7 Then
For $j = 0 To 9
$temp[$i][$j] = ''
Next
$temp[$i][0] = $ta[0]
$temp[$i][1] = $ta[1]
$temp[$i][2] = $ta[2] &' '& $ta[3]
$temp[$i][3] = $ta[4]
$temp[$i][5] = $ta[5]
$temp[$i][7] = $ta[6]
EndIf
Next
_ArrayDisplay($temp)
|