This commit is contained in:
csh 2023-07-26 14:35:05 +08:00
parent 880e03c41a
commit ced0d6b04c
5 changed files with 61 additions and 27 deletions

View File

@ -1,4 +1,4 @@
// Version 1.3.6
// Version 1.3.7
Function TOfficeObj(n);
Begin
@ -14237,12 +14237,13 @@ Type TCell = Class(TDocumentBody, TWTc)
Function Create(node);overload;
Begin
Class(TDocumentBody).Create(node);
Create(nil, 'w:tc');
Create(node, 'w:tc');
End;
Function Create(pNode, name);overload;
Begin
Class(TWTc).Create(pNode, 'w:tc');
Class(TWTc).Create(nil, 'w:tc');
InitRootNode(pNode);
name_ := 'w:tc';
mergeSpan_ := 0;
pPr_ := new TwpPr();
@ -14445,23 +14446,6 @@ Type TTable = Class(DocObject, TTableImpl)
TblGrid.GridCol := gridArr;
End;
Function RowHeight(row, height);
Begin
if row <= 0 or row > Rows() then return;
node := node_.FirstChildElement('w:tr');
cnt := row - 1;
while(cnt) do
begin
node := node.NextElement('w:tr');
cnt--;
end
trnode := node.FirstChildElement("w:trPr");
if not ifObj(trnode) then trnode := node.InsertFirstChild('element', 'w:trPr');
node := trnode.FirstChildElement('w:trHeight');
if not ifObj(node) then node := trnode.InsertFirstChild('element', 'w:trHeight');
node.SetAttribute('w:val', height);
End;
Property Format read readFormat;
Function readFormat();
Begin
@ -14518,6 +14502,45 @@ Type TTable = Class(DocObject, TTableImpl)
if n >0 and n <= length(TblGrid.GridCol) then
TblGrid.GridCol[n-1]['obj'].W := wth;
End;
/// 设置行高
Function RowHeight(row, height);
Begin
if row <= 0 or row > Rows() then return;
node := node_.FirstChildElement('w:tr');
cnt := row - 1;
while(cnt) do
begin
node := node.NextElement('w:tr');
cnt--;
end
trnode := node.FirstChildElement("w:trPr");
if not ifObj(trnode) then trnode := node.InsertFirstChild('element', 'w:trPr');
node := trnode.FirstChildElement('w:trHeight');
if not ifObj(node) then node := trnode.InsertFirstChild('element', 'w:trHeight');
node.SetAttribute('w:val', height);
End;
Function Height(row);
Begin
if row <= 0 or row > Rows() then return nil;
node := node_.FirstChildElement('w:tr');
cnt := row - 1;
while(cnt) do
begin
node := node.NextElement('w:tr');
cnt--;
end
obj := new TwTr();
obj.InitRootNode(node);
return obj.TrPr.Value('Height');
End;
Function Width(col);
Begin
obj := Cell(1, col);
return obj.Format.Value('Width');
End;
///合并单元格
///del: bool是否删除其它单元格内容只保留左上单元格内容

View File

@ -1,4 +1,4 @@
// Version 1.3.6
// Version 1.3.7
Type TSDocxFile = Class
///Version: V1.0 2022-09-20
@ -49,6 +49,7 @@ Type TSDocxFile = Class
Function OpenFile(alias, fname, passwd);
Begin
if not ifObj(zipfile_) then return array(-1, 'Create ZipFile object fail.');
if zipfile_.FilesCount() > 0 then zipfile_ := new ZipFile();
[err, errmsg] := zipfile_.Open(alias, fname, passwd);
if err=0 then Begin
document_ := new docxDocument(zipfile_);

View File

@ -1,4 +1,4 @@
// Version 1.3.6
// Version 1.3.7
Type TSExcelFile = Class
///Version: V1.0 2022-08-08
@ -49,8 +49,8 @@ Type TSExcelFile = Class
///返回: [err, errmsg]
Function OpenFile(alias, fname, passwd);
Begin
init();
if not ifObj(zipfile_) then return array(-1, 'Create ZipFile object fail.');
if zipfile_.FilesCount() > 0 then zipfile_ := new ZipFile();
[err, errmsg] := zipfile_.Open(alias, fname, passwd);
if err=0 then Begin
workbook_ := new xlsxWorkBook(zipfile_);

View File

@ -1,10 +1,10 @@
Type NodeInfo = class
public
Function Create(p, name);
Function Create(parentObj, name);
Begin
if ifObj(p) then
NodeUri := p.NodeUri = '' ? name : (p.NodeUri + '/' + name);
if ifObj(parentObj) then
NodeUri := parentObj.NodeUri = '' ? name : (parentObj.NodeUri + '/' + name);
else
NodeUri := '';
NodeName := name;
@ -270,7 +270,7 @@ public
ExtNodes;
//Parent;
ReplaceArr;
RootObj;
RootObj; // xml node
NodeUri:string;
children_;
End

View File

@ -1,5 +1,15 @@
# 更新日志
## 2023-7-26
### V1.3.7
新增表格获取高度和宽度方法`table.Height(row) table.Width(col)`
#### word
新增对表格的行高设置`table.RowHeight(row, height)`
## 2023-7-19
### V1.3.6