Page 1 of 1
Inserting rows shift HorizPageBreaks
Posted: Fri Sep 16, 2011 1:04 pm
by lam1809
I have Excel file with HorizPageBreaks.
I read it and insert rows in begin of it.
xrw.Sheet[0].Rows.InsertRows(nRow,nCount);
After saving I see that HorizPageBreaks was shift from his places up on nCount.
Its is Error or So must be?
Re: Inserting rows shift HorizPageBreaks
Posted: Mon Sep 19, 2011 8:59 am
by lam1809
Inserting rows not change value of row in collection HorizPageBreaks!
I dicided this so:
procedure xrwInsertRow(xrw: TXLSReadWriteII4; nRow:integer;nRowsCount:integer=1);
var
i: integer;
begin
xrw.Sheet[xrwSheet].InsertRows(nRow,nRowsCount); //вставим пустую строку
for i:=0 to xrw.Sheet[xrwSheet].PrintSettings.HorizPagebreaks.Count-1 do
if xrw.Sheet[xrwSheet].PrintSettings.HorizPagebreaks[i].Row>nRow then
xrw.Sheet[xrwSheet].PrintSettings.HorizPagebreaks[i].Row:=xrw.Sheet[xrwSheet].PrintSettings.HorizPagebreaks[i].Row+nRowsCount;
end;
Re: Inserting rows shift HorizPageBreaks
Posted: Thu Jul 26, 2012 11:28 am
by james321
Select the cell or the range of cells where you want to insert the new blank cells. Select the same number of cells as you want to insert. For example, to insert five blank cells, you need to select five cells.
Show How to select cells or ranges
On the Insert menu, click Cells.
Tip You can also right-click the selected cells and then click Insert on the shortcut menu.
In the Insert dialog box, click the direction in which you want to shift the surrounding cells.
Notes
When you insert cells on your worksheet, all references that are affected by the insertion adjust accordingly, whether they are relative or absolute references. The same applies to deleting cells, except when a deleted cell is directly referenced by a formula. If you want references to adjust automatically, it's a good idea to use range references whenever appropriate in your formulas, rather than specifying individual cells.
You can insert cells that contain data and formulas by copying or cutting them and then clicking Copied Cells or Cut Cells on the Insert menu.