From 15e2cbe6618e727e41d09a04f211d26f9fe73b70 Mon Sep 17 00:00:00 2001 From: csh Date: Thu, 7 Dec 2023 13:41:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B4=E7=90=86word=E5=86=85=E5=AE=B9?= =?UTF-8?q?=E4=BD=9C=E4=B8=BAunit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../document/TSWordTemplateMethods.tsf | 297 ++++++++++++++++++ funcext/TSOffice/word/_ExcelChartCopyPic.tsf | 6 - .../word/_WordAddOleObjectFromFile.tsf | 3 - funcext/TSOffice/word/_WordBr.tsf | 5 - funcext/TSOffice/word/_WordCopyFromExcel.tsf | 34 -- .../TSOffice/word/_WordCopyPicFromExcel.tsf | 3 - .../TSOffice/word/_WordGetCurrentDocument.tsf | 4 - .../TSOffice/word/_WordGetCurrentRange.tsf | 4 - funcext/TSOffice/word/_WordGetFont.tsf | 10 - funcext/TSOffice/word/_WordGetLastRange.tsf | 4 - funcext/TSOffice/word/_WordGetLastShape.tsf | 16 - funcext/TSOffice/word/_WordGetLastTable.tsf | 4 - .../word/_WordGetLastTableCellProp.tsf | 12 - .../TSOffice/word/_WordGetLastTableProp.tsf | 11 - funcext/TSOffice/word/_WordGetRangeProp.tsf | 3 - funcext/TSOffice/word/_WordLastTableMerge.tsf | 11 - funcext/TSOffice/word/_WordLastTableSplit.tsf | 3 - .../TSOffice/word/_WordSetCurrentRange.tsf | 4 - .../TSOffice/word/_WordSetCurrnetRange.tsf | 4 - funcext/TSOffice/word/_WordSetFont.tsf | 8 - .../word/_WordSetLastTableCellProp.tsf | 17 - .../TSOffice/word/_WordSetLastTableProp.tsf | 17 - funcext/TSOffice/word/_WordSetRangeProp.tsf | 5 - funcext/TSOffice/word/_WordTemplate.tsf | 14 - funcext/TSOffice/word/_WordWrite.tsf | 17 - .../TSOffice/word/_WordWritePicFromFile.tsf | 11 - funcext/TSOffice/word/_WordWriteTable.tsf | 8 - funcext/TSOffice/word/_wordCompTable.tsf | 10 - funcext/TSOffice/word/create.tsf | 26 -- 29 files changed, 297 insertions(+), 274 deletions(-) create mode 100644 funcext/TSOffice/document/TSWordTemplateMethods.tsf delete mode 100644 funcext/TSOffice/word/_ExcelChartCopyPic.tsf delete mode 100644 funcext/TSOffice/word/_WordAddOleObjectFromFile.tsf delete mode 100644 funcext/TSOffice/word/_WordBr.tsf delete mode 100644 funcext/TSOffice/word/_WordCopyFromExcel.tsf delete mode 100644 funcext/TSOffice/word/_WordCopyPicFromExcel.tsf delete mode 100644 funcext/TSOffice/word/_WordGetCurrentDocument.tsf delete mode 100644 funcext/TSOffice/word/_WordGetCurrentRange.tsf delete mode 100644 funcext/TSOffice/word/_WordGetFont.tsf delete mode 100644 funcext/TSOffice/word/_WordGetLastRange.tsf delete mode 100644 funcext/TSOffice/word/_WordGetLastShape.tsf delete mode 100644 funcext/TSOffice/word/_WordGetLastTable.tsf delete mode 100644 funcext/TSOffice/word/_WordGetLastTableCellProp.tsf delete mode 100644 funcext/TSOffice/word/_WordGetLastTableProp.tsf delete mode 100644 funcext/TSOffice/word/_WordGetRangeProp.tsf delete mode 100644 funcext/TSOffice/word/_WordLastTableMerge.tsf delete mode 100644 funcext/TSOffice/word/_WordLastTableSplit.tsf delete mode 100644 funcext/TSOffice/word/_WordSetCurrentRange.tsf delete mode 100644 funcext/TSOffice/word/_WordSetCurrnetRange.tsf delete mode 100644 funcext/TSOffice/word/_WordSetFont.tsf delete mode 100644 funcext/TSOffice/word/_WordSetLastTableCellProp.tsf delete mode 100644 funcext/TSOffice/word/_WordSetLastTableProp.tsf delete mode 100644 funcext/TSOffice/word/_WordSetRangeProp.tsf delete mode 100644 funcext/TSOffice/word/_WordTemplate.tsf delete mode 100644 funcext/TSOffice/word/_WordWrite.tsf delete mode 100644 funcext/TSOffice/word/_WordWritePicFromFile.tsf delete mode 100644 funcext/TSOffice/word/_WordWriteTable.tsf delete mode 100644 funcext/TSOffice/word/_wordCompTable.tsf delete mode 100644 funcext/TSOffice/word/create.tsf diff --git a/funcext/TSOffice/document/TSWordTemplateMethods.tsf b/funcext/TSOffice/document/TSWordTemplateMethods.tsf new file mode 100644 index 0000000..58e032a --- /dev/null +++ b/funcext/TSOffice/document/TSWordTemplateMethods.tsf @@ -0,0 +1,297 @@ +Unit TSWordTemplateMethods; +Interface + Function ExcelChartCopyPic(excelFileName, excelSheetName, chartName, width, height); + Function WordAddOleObjectFromFile(fileName, width, height); + Function WordBr(); + Function WordCopyFromExcel(excelFileName, excelSheetName, startRow, startCol, endRow, endCol); + Function WordGetCurrentDocument(); + Function WordGetCurrentRange(); + Function WordGetFont(prop, value); + Function WordGetLastRange(); + Function WordGetLastShape(); + Function WordGetLastTable(); + Function WordGetLastTableCellProp(row, col, name, value); + Function WordGetLastTableProp(name, value); + Function WordLastTableMerge(row1, col1, row2, col2); + Function WordSetCurrentRange(range); + Function WordSetFont(prop, value); + Function WordSetLastTableCellProp(row, col, name, value); + Function WordSetLastTableProp(name, value); + Function WordSetRangeProp(name, value); + Function WordTemplate(data, template, fileName); + Function WordWrite(); + Function WordWritePicFromFile(fileName); + Function WordWriteTable(table, writeIntIndex, writeIntTitle, incIntIndex); + +Implementation + Function ExcelChartCopyPic(excelFileName, excelSheetName, chartName, width, height); + Begin + docx := TOfficeApi().GetDocument(); + chart := docx.CopyExcelChart(excelFileName, excelSheetName, chartName, width, height, TOfficeApi().GetCurrentPosition()); + return ifObj(chart); + End; + + Function WordBr(); + Begin + TOfficeApi().GetDocument().AddLineBreak(TOfficeApi().Get('CurrentPosition')); + End; + + Function WordCopyFromExcel(excelFileName, excelSheetName, startRow, startCol, endRow, endCol); + Begin + excel := new TSXlsFile(); + [err, msg] := excel.OpenFile('', excelFileName); + if err then return false; + total_row := excel.TotalRows(excelSheetName); + total_col := excel.TotalCols(excelSheetName); + if not total_row or not total_col then return false; + if ifnil(startRow) then + startRow := 1; + if ifnil(startCol) then + startCol := 1; + if ifnil(endRow) then + endRow := total_row; + if ifnil(endCol) then + endCol := total_col; + data := excel.GetTable(excelSheetName, + CoordinatesToCellName(startCol, startRow), + CoordinatesToCellName(endCol, endRow), + false, + false, + false); + if length(data) = 0 then return false; + //println('data={}',data); + docx := TOfficeApi().GetDocument(); + tbl := docx.CreateTable(data, false, false); + tbl.Format.Borders.Top.Val := 'dashed'; + tbl.Format.Borders.Left.Val := 'dashed'; + tbl.Format.Borders.Bottom.Val := 'dashed'; + tbl.Format.Borders.Right.Val := 'dashed'; + tbl.Format.Borders.InsideH.Val := 'dashed'; + tbl.Format.Borders.InsideV.Val := 'dashed'; + tbl := docx.InsertTable(tbl, TOfficeApi().GetCurrentPosition()); + End; + + Function WordGetCurrentDocument(); + Begin + return TOfficeApi().GetDocument(); + End; + + Function WordGetCurrentRange(); + Begin + return TOfficeApi().GetCurrentPosition(); + End; + + Function WordGetFont(prop, value); + Begin + crun := TOfficeApi().GetCurrentRun(); + node := crun.Node().FirstChildElement('w:rPr'); + rPr := TOfficeObj('TwrPr'); + rPr.InitRootNode(node); + value := rPr.Value(prop); + if not ifnil(value) then return true; + return false; + End; + + Function WordGetLastShape(); + Begin + node := TOfficeApi().Get('CurrentShape'); + if not ifObj(node) then return nil; + uri := 'w:r/w:drawing/wp:inline/a:graphic/a:graphicData/c:chart'; + cNode := class(TSXml).GetNode(node, uri); + if ifObj(cNode) then Begin + chart := TOfficeObj('TChart'); + chart.Init(TOfficeApi().GetDocument(), node, cNode); + return chart; + End; + + pic := TOfficeObj('TPicture'); + pic.Init(node); + return pic; + End; + + Function WordGetLastRange(); + Begin + return TOfficeApi().GetCurrentPosition(); + End; + + Function WordGetLastTable(); + Begin + return TOfficeApi().Get('CurrentTable'); + End; + + Function WordGetLastTableCellProp(row, col, name, value); + Begin + table_node := TOfficeApi().Get('CurrentTable'); + if ifnil(table_node) then return false; + table := TOfficeObj("TTable"); + table.Init(table_node); + table_cell := table.Cell(row, col); + ctr := _wordCompTable(); + name_ := ctr[lowercase(name)]; + if ifnil(name_) then name_ := name; + str := 'return table_cell.Format.' $ name_ $ '"' $ value $ '"'; + value := eval(&str); + return true; + End; + + Function WordGetLastTableProp(name, value); + Begin + table_node := TOfficeApi().Get('CurrentTable'); + if ifnil(table_node) then return false; + table := TOfficeObj("TTable"); + table.Init(table_node); + ctr := _wordCompTable(); + name_ := ctr[lowercase(name)]; + if ifnil(name_) then name_ := name; + str := 'return table.Format.' $ name_ $ '"' $ value $ '"'; + value := eval(&str); + return true; + End; + + Function WordLastTableMerge(row1, col1, row2, col2); + Begin + table_node := TOfficeApi().Get('CurrentTable'); + if ifnil(table_node) then return false; + table := TOfficeObj("TTable"); + table.Init(table_node); + [err1, beg_cell] := CoordinatesToCellName(col1, row1); + [err2, end_cell] := CoordinatesToCellName(col2, row2); + if err1 or err2 then return false; + table.Merge(beg_cell, end_cell, false); + return true; + End; + + Function WordSetCurrentRange(range); + Begin + TOfficeApi().Set('CurrentPosition', range); + End; + + Function WordSetFont(prop, value); + Begin + run := TOfficeApi().GetCurrentRun(); + str := 'run.font.' $ prop $ ' := ' $ '"' $ value $ '"'; + eval(&str); + run.Apply(); + return true; + End; + + Function WordSetLastTableCellProp(row, col, name, value); + Begin + table := TOfficeApi().Get('CurrentTable'); + if ifnil(table) then return false; + table_cell := table.Cell(row, col); + ctr := _wordCompTable(); + name_ := ctr[lowercase(name)]; + if ifnil(name_) then name_ := name; + str := 'table_cell.Format.' $ name_ $ ' := '; + if ifstring(value) then + str += '"' $ value $ '"'; + else + str := str $ value; + eval(&str); + return true; + End; + + Function WordSetLastTableProp(name, value); + Begin + table := TOfficeApi().Get('CurrentTable'); + if ifnil(table) then return false; + ctr := _wordCompTable(); + name_ := ctr[lowercase(name)]; + if ifnil(name_) then name_ := name; + str := 'table.Format.' $ name_ $ ' := '; + if ifstring(value) then + str += '"' $ value $ '"'; + else + str := str $ value; + eval(&str); + TOfficeApi().Set('CurrentTable', table); + return true; + End; + + Function WordSetRangeProp(name, value); + Begin + cur := TOfficeApi().GetCurrentPosition(); + if ifnil(cur) then return nil; + End; + + Function WordTemplate(data, template, fileName); + Begin + setsysparam('data', data); + docx := new TSDocxFile(); + [err, msg] := docx.OpenFile('', template); + if err then return false; + docx.ExecInnerTSL(); + if ifstring(fileName) then + begin + [err, msg] := docx.SaveAs('', fileName); + if err then return false; + end + return true; + End; + + Function WordWrite(); + Begin + docx := TOfficeApi().GetDocument(); + curParagraph := TOfficeApi().GetCurrentParagraph(); + curRun := TOfficeApi().GetCurrentRun(); + for i:=1 to PARAMCOUNT do Begin + argv := params[i]; + if ifstring( argv ) then + curRun.AddText( argv ); + else if ifnumber(argv) then + curRun.AddText('' $ argv); + else if ifarray(argv) then Begin + tbl := docx.CreateTable(argv, false, false); + tbl := docx.InsertTable(tbl, TOfficeApi().GetCurrentPosition()); + End + End + End; + + Function WordWritePicFromFile(fileName); + Begin + file_size := fileSize('', fileName); + flag := readfile(rwbinary(), '', fileName, 0, file_size, data); + if not flag then return false; + picture := TOfficeObj('TPicture'); + picture.Image := data; + docx := TOfficeApi().GetDocument(); + docx.AddPicture(picture, TOfficeApi().GetCurrentPosition()); + return true; + End; + + Function WordWriteTable(table, writeIntIndex, writeIntTitle, incIntIndex); + Begin + docx := TOfficeApi().GetDocument(); + tbl := docx.CreateTable(table, true, writeIntIndex); + table := docx.InsertTable(tbl, TOfficeApi().GetCurrentPosition()); + return true; + End; + + Function _wordCompTable(); + Begin + return array( + 'alignment': 'Alignment', + 'shadingcolor': 'Shading.Color', + 'style': 'StyleID', + 'verticalalignment': 'Valign', + 'width': 'Width', + ); + End; + + // TODO:尚未支持 + Function WordAddOleObjectFromFile(fileName, width, height); + Begin + End; + Function WordCopyPicFormatExcel(excelFileName, excelSheetName, startRow, startCol, endRow, endCol, picType); + Begin + End; + Function WordGetRangeProp(name, value); + Begin + End; + Function WordLastTableSplit(row, col, rCnt, cCnt); + Begin + End; + +End. + diff --git a/funcext/TSOffice/word/_ExcelChartCopyPic.tsf b/funcext/TSOffice/word/_ExcelChartCopyPic.tsf deleted file mode 100644 index df0734d..0000000 --- a/funcext/TSOffice/word/_ExcelChartCopyPic.tsf +++ /dev/null @@ -1,6 +0,0 @@ -Function _ExcelChartCopyPic(excelFileName, excelSheetName, chartName, Width, Height); -Begin - docx := TOfficeApi().GetDocument(); - chart := docx.CopyExcelChart(excelFileName, excelSheetName, chartName, Width, Height, TOfficeApi().GetCurrentPosition()); - return ifObj(chart); -End; \ No newline at end of file diff --git a/funcext/TSOffice/word/_WordAddOleObjectFromFile.tsf b/funcext/TSOffice/word/_WordAddOleObjectFromFile.tsf deleted file mode 100644 index 7843725..0000000 --- a/funcext/TSOffice/word/_WordAddOleObjectFromFile.tsf +++ /dev/null @@ -1,3 +0,0 @@ -Function _WordAddOleObjectFromFile(fileName, width, height); -Begin -End; \ No newline at end of file diff --git a/funcext/TSOffice/word/_WordBr.tsf b/funcext/TSOffice/word/_WordBr.tsf deleted file mode 100644 index 162c79b..0000000 --- a/funcext/TSOffice/word/_WordBr.tsf +++ /dev/null @@ -1,5 +0,0 @@ -Function _WordBr(); -Begin - TOfficeApi().GetDocument().AddLineBreak(TOfficeApi().Get('CurrentPosition')); -End; - diff --git a/funcext/TSOffice/word/_WordCopyFromExcel.tsf b/funcext/TSOffice/word/_WordCopyFromExcel.tsf deleted file mode 100644 index c910872..0000000 --- a/funcext/TSOffice/word/_WordCopyFromExcel.tsf +++ /dev/null @@ -1,34 +0,0 @@ -Function _WordCopyFromExcel(excelFileName, excelSheetName, startRow, startCol, endRow, endCol); -Begin - excel := new TSExcelFile(); - [err, msg] := excel.OpenFile('', excelFileName); - if err then return false; - total_row := excel.TotalRows(excelSheetName); - total_col := excel.TotalCols(excelSheetName); - if not total_row or not total_col then return false; - if ifnil(startRow) then - startRow := 1; - if ifnil(startCol) then - startCol := 1; - if ifnil(endRow) then - endRow := total_row; - if ifnil(endCol) then - endCol := total_col; - data := excel.GetTable(excelSheetName, - CoordinatesToCellName(startCol, startRow), - CoordinatesToCellName(endCol, endRow), - false, - false, - false); - if length(data) = 0 then return false; - //println('data={}',data); - docx := TOfficeApi().GetDocument(); - tbl := docx.CreateTable(data, false, false); - tbl.Format.Borders.Top.Val := 'dashed'; - tbl.Format.Borders.Left.Val := 'dashed'; - tbl.Format.Borders.Bottom.Val := 'dashed'; - tbl.Format.Borders.Right.Val := 'dashed'; - tbl.Format.Borders.InsideH.Val := 'dashed'; - tbl.Format.Borders.InsideV.Val := 'dashed'; - tbl := docx.InsertTable(tbl, TOfficeApi().GetCurrentPosition()); -End; diff --git a/funcext/TSOffice/word/_WordCopyPicFromExcel.tsf b/funcext/TSOffice/word/_WordCopyPicFromExcel.tsf deleted file mode 100644 index 80a9ab1..0000000 --- a/funcext/TSOffice/word/_WordCopyPicFromExcel.tsf +++ /dev/null @@ -1,3 +0,0 @@ -Function _WordCopyPicFormatExcel(excelFileName, excelSheetName, startRow, startCol, endRow, endCol, picType); -Begin -End; \ No newline at end of file diff --git a/funcext/TSOffice/word/_WordGetCurrentDocument.tsf b/funcext/TSOffice/word/_WordGetCurrentDocument.tsf deleted file mode 100644 index 2de32b1..0000000 --- a/funcext/TSOffice/word/_WordGetCurrentDocument.tsf +++ /dev/null @@ -1,4 +0,0 @@ -Function _WordGetCurrentDocument(); -Begin - return TOfficeApi().GetDocument(); -End; \ No newline at end of file diff --git a/funcext/TSOffice/word/_WordGetCurrentRange.tsf b/funcext/TSOffice/word/_WordGetCurrentRange.tsf deleted file mode 100644 index 8503ae5..0000000 --- a/funcext/TSOffice/word/_WordGetCurrentRange.tsf +++ /dev/null @@ -1,4 +0,0 @@ -Function _WordGetCurrentRange(); -Begin - return TOfficeApi().GetCurrentPosition(); -End; \ No newline at end of file diff --git a/funcext/TSOffice/word/_WordGetFont.tsf b/funcext/TSOffice/word/_WordGetFont.tsf deleted file mode 100644 index e495c26..0000000 --- a/funcext/TSOffice/word/_WordGetFont.tsf +++ /dev/null @@ -1,10 +0,0 @@ -Function _WordGetFont(prop, value); -Begin - crun := TOfficeApi().GetCurrentRun(); - node := crun.Node().FirstChildElement('w:rPr'); - rPr := TOfficeObj('TwrPr'); - rPr.InitRootNode(node); - value := rPr.Value(prop); - if not ifnil(value) then return true; - return false; -End; diff --git a/funcext/TSOffice/word/_WordGetLastRange.tsf b/funcext/TSOffice/word/_WordGetLastRange.tsf deleted file mode 100644 index 2daa3e5..0000000 --- a/funcext/TSOffice/word/_WordGetLastRange.tsf +++ /dev/null @@ -1,4 +0,0 @@ -Function _WordGetLastRange(); -Begin - return TOfficeApi().GetCurrentPosition(); -End; \ No newline at end of file diff --git a/funcext/TSOffice/word/_WordGetLastShape.tsf b/funcext/TSOffice/word/_WordGetLastShape.tsf deleted file mode 100644 index ea5ab59..0000000 --- a/funcext/TSOffice/word/_WordGetLastShape.tsf +++ /dev/null @@ -1,16 +0,0 @@ -Function _WordGetLastShape(); -Begin - node := TOfficeApi().Get('CurrentShape'); - if not ifObj(node) then return nil; - uri := 'w:r/w:drawing/wp:inline/a:graphic/a:graphicData/c:chart'; - cNode := class(TSXml).GetNode(node, uri); - if ifObj(cNode) then Begin - chart := TOfficeObj('TChart'); - chart.Init(TOfficeApi().GetDocument(), node, cNode); - return chart; - End; - - pic := TOfficeObj('TPicture'); - pic.Init(node); - return pic; -End; \ No newline at end of file diff --git a/funcext/TSOffice/word/_WordGetLastTable.tsf b/funcext/TSOffice/word/_WordGetLastTable.tsf deleted file mode 100644 index cb268cc..0000000 --- a/funcext/TSOffice/word/_WordGetLastTable.tsf +++ /dev/null @@ -1,4 +0,0 @@ -Function _WordGetLastTable(); -Begin - return TOfficeApi().Get('LastTable'); -End; \ No newline at end of file diff --git a/funcext/TSOffice/word/_WordGetLastTableCellProp.tsf b/funcext/TSOffice/word/_WordGetLastTableCellProp.tsf deleted file mode 100644 index 7a5df00..0000000 --- a/funcext/TSOffice/word/_WordGetLastTableCellProp.tsf +++ /dev/null @@ -1,12 +0,0 @@ -Function _WordGetLastTableCellProp(row, col, name, value); -Begin - table := TOfficeApi().Get('LastTable'); - if ifnil(table) then return false; - table_cell := table.Cell(row, col); - ctr := _wordCompTable(); - name_ := ctr[lowercase(name)]; - if ifnil(name_) then name_ := name; - str := 'return table_cell.Format.' $ name_ $ '"' $ value $ '"'; - value := eval(&str); - return true; -End; diff --git a/funcext/TSOffice/word/_WordGetLastTableProp.tsf b/funcext/TSOffice/word/_WordGetLastTableProp.tsf deleted file mode 100644 index 46b0520..0000000 --- a/funcext/TSOffice/word/_WordGetLastTableProp.tsf +++ /dev/null @@ -1,11 +0,0 @@ -Function _WordGetLastTableProp(name, value); -Begin - table := TOfficeApi().Get('LastTable'); - if ifnil(table) then return false; - ctr := _wordCompTable(); - name_ := ctr[lowercase(name)]; - if ifnil(name_) then name_ := name; - str := 'return table.Format.' $ name_ $ '"' $ value $ '"'; - value := eval(&str); - return true; -End; diff --git a/funcext/TSOffice/word/_WordGetRangeProp.tsf b/funcext/TSOffice/word/_WordGetRangeProp.tsf deleted file mode 100644 index 40dc9a8..0000000 --- a/funcext/TSOffice/word/_WordGetRangeProp.tsf +++ /dev/null @@ -1,3 +0,0 @@ -Function _WordGetRangeProp(name, value); -Begin -End; \ No newline at end of file diff --git a/funcext/TSOffice/word/_WordLastTableMerge.tsf b/funcext/TSOffice/word/_WordLastTableMerge.tsf deleted file mode 100644 index a7abd34..0000000 --- a/funcext/TSOffice/word/_WordLastTableMerge.tsf +++ /dev/null @@ -1,11 +0,0 @@ -Function _WordLastTableMerge(row1, col1, row2, col2); -Begin - table := TOfficeApi().Get('LastTable'); - if ifnil(table) then return false; - [err1, beg_cell] := CoordinatesToCellName(col1, row1); - [err2, end_cell] := CoordinatesToCellName(col2, row2); - if err1 or err2 then return false; - table.Merge(beg_cell, end_cell, false); - TOfficeApi().Set('LastTable', table); - return true; -End; diff --git a/funcext/TSOffice/word/_WordLastTableSplit.tsf b/funcext/TSOffice/word/_WordLastTableSplit.tsf deleted file mode 100644 index ca6dd90..0000000 --- a/funcext/TSOffice/word/_WordLastTableSplit.tsf +++ /dev/null @@ -1,3 +0,0 @@ -Function _WordLastTableSplit(row, col, rCnt, cCnt); -Begin -End; diff --git a/funcext/TSOffice/word/_WordSetCurrentRange.tsf b/funcext/TSOffice/word/_WordSetCurrentRange.tsf deleted file mode 100644 index 164e117..0000000 --- a/funcext/TSOffice/word/_WordSetCurrentRange.tsf +++ /dev/null @@ -1,4 +0,0 @@ -Function _WordSetCurrentRange(range); -Begin - TOfficeApi().Set('CurrentPosition', range); -End; diff --git a/funcext/TSOffice/word/_WordSetCurrnetRange.tsf b/funcext/TSOffice/word/_WordSetCurrnetRange.tsf deleted file mode 100644 index 73678f5..0000000 --- a/funcext/TSOffice/word/_WordSetCurrnetRange.tsf +++ /dev/null @@ -1,4 +0,0 @@ -Function _WordSetCurrnetRange(range); -Begin - TOfficeApi().Set('CurrentPosition', range); -End; \ No newline at end of file diff --git a/funcext/TSOffice/word/_WordSetFont.tsf b/funcext/TSOffice/word/_WordSetFont.tsf deleted file mode 100644 index c22bbe1..0000000 --- a/funcext/TSOffice/word/_WordSetFont.tsf +++ /dev/null @@ -1,8 +0,0 @@ -Function _WordSetFont(prop, value); -Begin - run := TOfficeApi().GetCurrentRun(); - str := 'run.font.' $ prop $ ' := ' $ '"' $ value $ '"'; - eval(&str); - run.Apply(); - return true; -End; diff --git a/funcext/TSOffice/word/_WordSetLastTableCellProp.tsf b/funcext/TSOffice/word/_WordSetLastTableCellProp.tsf deleted file mode 100644 index 3fbe9ac..0000000 --- a/funcext/TSOffice/word/_WordSetLastTableCellProp.tsf +++ /dev/null @@ -1,17 +0,0 @@ -Function _WordSetLastTableCellProp(row, col, name, value); -Begin - table := TOfficeApi().Get('LastTable'); - if ifnil(table) then return false; - table_cell := table.Cell(row, col); - ctr := _wordCompTable(); - name_ := ctr[lowercase(name)]; - if ifnil(name_) then name_ := name; - str := 'table_cell.Format.' $ name_ $ ' := '; - if ifstring(value) then - str += '"' $ value $ '"'; - else - str = str $ value; - eval(&str); - TOfficeApi().Set('LastTable', table); - return true; -End; diff --git a/funcext/TSOffice/word/_WordSetLastTableProp.tsf b/funcext/TSOffice/word/_WordSetLastTableProp.tsf deleted file mode 100644 index 52df9a0..0000000 --- a/funcext/TSOffice/word/_WordSetLastTableProp.tsf +++ /dev/null @@ -1,17 +0,0 @@ -Function _WordSetLastTableProp(name, value); -Begin - table := TOfficeApi().Get('LastTable'); - if ifnil(table) then return false; - ctr := _wordCompTable(); - name_ := ctr[lowercase(name)]; - if ifnil(name_) then name_ := name; - str := 'table.Format.' $ name_ $ ' := '; - if ifstring(value) then - str += '"' $ value $ '"'; - else - str = str $ value; - eval(&str); - TOfficeApi().Set('LastTable', table); - return true; -End; - diff --git a/funcext/TSOffice/word/_WordSetRangeProp.tsf b/funcext/TSOffice/word/_WordSetRangeProp.tsf deleted file mode 100644 index e382cc1..0000000 --- a/funcext/TSOffice/word/_WordSetRangeProp.tsf +++ /dev/null @@ -1,5 +0,0 @@ -Function _WordSetRangeProp(name, value); -Begin - cur := TOfficeApi().GetCurrentPosition(); - if ifnil(cur) then return nil; -End; diff --git a/funcext/TSOffice/word/_WordTemplate.tsf b/funcext/TSOffice/word/_WordTemplate.tsf deleted file mode 100644 index bf862a7..0000000 --- a/funcext/TSOffice/word/_WordTemplate.tsf +++ /dev/null @@ -1,14 +0,0 @@ -Function _WordTemplate(data, template, fileName); -Begin - setsysparam('data', data); - docx := new TSDocxFile(); - [err, msg] := docx.OpenFile('', template); - if err then return false; - docx.ExecInnerTSL(); - if ifstring(fileName) then - begin - [err, msg] := docx.SaveAs('', fileName); - if err then return false; - end - return true; -End; diff --git a/funcext/TSOffice/word/_WordWrite.tsf b/funcext/TSOffice/word/_WordWrite.tsf deleted file mode 100644 index d515d57..0000000 --- a/funcext/TSOffice/word/_WordWrite.tsf +++ /dev/null @@ -1,17 +0,0 @@ -Function _WordWrite(); -Begin - docx := TOfficeApi().GetDocument(); - curParagraph := TOfficeApi().GetCurrentParagraph(); - curRun := TOfficeApi().GetCurrentRun(); - for i:=1 to PARAMCOUNT do Begin - argv := params[i]; - if ifstring( argv ) then - curRun.AddText( argv ); - else if ifnumber(argv) then - curRun.AddText('' $ argv); - else if ifarray(argv) then Begin - tbl := docx.CreateTable(argv, false, false); - tbl := docx.InsertTable(tbl, TOfficeApi().GetCurrentPosition()); - End - End -End; \ No newline at end of file diff --git a/funcext/TSOffice/word/_WordWritePicFromFile.tsf b/funcext/TSOffice/word/_WordWritePicFromFile.tsf deleted file mode 100644 index 1620f76..0000000 --- a/funcext/TSOffice/word/_WordWritePicFromFile.tsf +++ /dev/null @@ -1,11 +0,0 @@ -Function _WordWritePicFromFile(fileName); -Begin - file_size := fileSize('', fileName); - flag := readfile(rwbinary(), '', fileName, 0, file_size, data); - if not flag then return false; - picture := TOfficeObj('TPicture'); - picture.Image := data; - docx := TOfficeApi().GetDocument(); - docx.AddPicture(picture, TOfficeApi().GetCurrentPosition()); - return true; -End; diff --git a/funcext/TSOffice/word/_WordWriteTable.tsf b/funcext/TSOffice/word/_WordWriteTable.tsf deleted file mode 100644 index 4cf3581..0000000 --- a/funcext/TSOffice/word/_WordWriteTable.tsf +++ /dev/null @@ -1,8 +0,0 @@ -Function _WordWriteTable(table, writeIntIndex, writeIntTitle, incIntIndex); -Begin - docx := TOfficeApi().GetDocument(); - tbl := docx.CreateTable(table, true, writeIntIndex); - table := docx.InsertTable(tbl, TOfficeApi().GetCurrentPosition()); - TOfficeApi().Set('LastTable', table); - return true; -End; diff --git a/funcext/TSOffice/word/_wordCompTable.tsf b/funcext/TSOffice/word/_wordCompTable.tsf deleted file mode 100644 index b58a7ea..0000000 --- a/funcext/TSOffice/word/_wordCompTable.tsf +++ /dev/null @@ -1,10 +0,0 @@ -Function _wordCompTable(); -Begin - return array( - 'alignment': 'Alignment', - 'shadingcolor': 'Shading.Color', - 'style': 'StyleID', - 'verticalalignment': 'Valign', - 'width': 'Width', - ); -End; diff --git a/funcext/TSOffice/word/create.tsf b/funcext/TSOffice/word/create.tsf deleted file mode 100644 index 7af5431..0000000 --- a/funcext/TSOffice/word/create.tsf +++ /dev/null @@ -1,26 +0,0 @@ -_WordTemplate(alias, fileName); -_WordCopyFromExcel(excelFileName, excelSheetName, startRow, startCol, endRow, endCol); -_WordCopyPicFromExcel(excelFileName, excelSheetName, startRow, startCol, endRow, endCol, picType); -_ExcelChartCopyPic(excelFileName, excelSheetName, picType); -_WordGetCurrentDocument(); -_WordGetCurrentRange(); -_WordSetCurrnetRange(range); -_WordGetLastRange(); -_WordGetLastTable(); -_WordGetLastShape(); -_WordWrite(); -_WordBr(); -_WordWriteTable(table, writeIntIndex, writeIntTile, incIntIndex); -_WordWritePicFromFile(fileName); -_WordSetFont(prop, value); -_WordGetFont(prop, value); -_WordAddOleObjectFromFile(fileName, width, height); -_WordLastTableSplit(row, col, rCnt, cCnt); -_WordLastTableMerge(row1, col1, row2, col2); -_WordSetRangeProp(name, value); -_WordGetRangeProp(name, value); -_WordSetLastTableProp(name, value); -_WordGetLastTableProp(name, value); -_WordSetLastTableCellProp(row, col, name, value); -_WordGetLastTableCellProp(row, col, name, value); -