如何用Delphi 删除Execel 中的第一列?
解决方案 »
- delphi如何把路由 自动断开然后在自动连接上
- 关于数据比较的问题 100分求
- 有关报表的问题
- 请高手帮忙!自动生成问题!急!!
- 我想做个XXX管理系统,不知如何下手,请大虾指教一二~~~~~~~~
- 怎样求stringgrid某列值的和?
- 请教网页操作方面的问题:
- 怎样判断在同一个窗口中是否有dbgrid和dbedit等具有db属性的控件?在线等待
- 如何将 STRING 类型转换为 PCHAR 类型 ???
- 我们写的系统,每次到了业务繁忙的时候,服务器就停住,客户端出现‘dead lock’,也就是1—2分钟,求救!
- ACCESS数据库SQL查询奇怪的问题
- cadimportvcl 5.25版,谁要?
Sheet.Cells[nCurrRow,1] := pTail;
sheet.range[sheet.cells[nCurrRow, 1],sheet.cells[nCurrRow,nCols]].Select; //选择该列
Excelid.selection.HorizontalAlignment := $FFFFEFF4; //居中
Excelid.selection.MergeCells := True;
ExcelApp.ActiveSheet.Columns[1].Delete;
try
Excelid := CreateOLEObject('Excel.Application');
except
Application.MessageBox('Excel没有安装!', '提示信息', MB_OK+MB_ICONASTERISK+MB_DEFBUTTON1+MB_APPLMODAL);
Exit;
end;
Excelid.Visible := false; Excelid.WorkBooks.Add; Sheet := Excelid.Workbooks[1].WorkSheets[1]; nCurrRow := 1;
if SePTitle <> '' then begin
Sheet.Cells[1,1] := SePTitle;
sheet.range[sheet.cells[2, 1],sheet.cells[2,nCols]].Select; //选择该列
//Excelid.selection.HorizontalAlignment := $FFFFEFF4; //居中
Excelid.selection.MergeCells := True;
//表体(包括表头)
nCurrRow := 2;
end;
ProgressBar1.Position :=0;
ProgressBar1.Max :=mGrid.RowCount;
for i:=0 to mGrid.RowCount-1 do begin
ProgressBar1.Position :=ProgressBar1.Position +1;
nCurrCol := 1;
for j:=0 to mGrid.ColCount-1 do begin
if mGrid.ColWidths[j]>0 then begin
if (j=2)or (j=4) or( j=5) then begin
Sheet.Cells[nCurrRow,nCurrCol].NumberFormatLocal := '@';
Sheet.Cells[nCurrRow,nCurrCol] := mGrid.Cells[j,i];
end else begin
Sheet.Cells[nCurrRow,nCurrCol] := mGrid.Cells[j,i]; end;
nCurrCol := nCurrCol + 1;
end;
end;
nCurrRow := nCurrRow + 1;
end;
Sheet.Columns[1].Delete;
// ExcelApp.ActiveSheet.Columns[1].Delete
//表尾文字
Sheet.Cells[nCurrRow,1] := pTail;
sheet.range[sheet.cells[nCurrRow, 1],sheet.cells[nCurrRow,nCols]].Select; //选择该列 Excelid.selection.HorizontalAlignment := $FFFFEFF4; //居中
Excelid.selection.MergeCells := True; try
sheet.cells[1,1].Select; Excelid.Workbooks[1].SaveAs(FileName); Excelid.Workbooks[1].close;
Excelid.Quit;
except
Excelid.Quit; //有时写完后立即退出,但写进程还占用着该文件,不允许退出,所以这里再退出一次
end; //实际上就是设一点点延迟,
Excelid := Unassigned;
end else begin
strlist.Add(pTitle);
for i:=0 to mGrid.rowcount -1 do begin
for j:=0 to mGrid.ColCount - 1 do begin
str := str + mGrid.Cells[j,i] + #9;
end;
strList.Add(str);
str := '';
end;
strlist.Add(pTail);
strList.SaveToFile(Filename);
strlist.Free;
strlist := nil;
end;如何进行删除。?