Help- problem Range.Copy


#1

Excel ex = new Excel();
ex.Open( "SSTMPL2b.XLS" ); // included two sheets.

Cells cells1 = ex.Worksheets[1].Cells;
Cells cells0 = ex.Worksheets[0].Cells;

Range rngSrc = cells1.CreateRange( 14, 0, 10, 22 ); // included easy macro.
Range rngDst = cells0.CreateRange( 13, 0, 10, 22 ); // copy to another sheet.
rngDst.Copy( rngSrc );

ex.Save("test.xls", FileFormatType.Default );


but "test.xls" file is broken and "#REF!" cells appear.


#2

That a bug while copying range in two difference worksheets. I will check and fix this issue ASAP.


#3

Try this fix please.


#4

Thank you for your quick reply and I tested a new object.
But, I found a other bug.

//-------------------------------------------------------
Excel ex = new Excel();
ex.Open( "SSTMPL2b.XLS" );

Cells cellSrc = ex.Worksheets[1].Cells;
Range rngSrc1 = cellSrc.CreateRange( 14,0,10,22 );

Cells cellDst = ex.Worksheets[0].Cells;

Range rngDst = cellDst.CreateRange( 30,0,10,22 );
rngDst.Copy( rngSrc1 );

ex.Worksheets[0].Copy( ex.Worksheets[1] ); // Copy to "Sheet2"

ex.Save("test.xls", FileFormatType.Default );
//-------------------------------------------------------

I opned the test.xls in Excel and input values that "D15"=1000 and "D31"=1000 in "Sheet2".

"D19"=1000 is valid and "D20"=2000 is valid.

But, Range.Copy Cells value is wrong.

"D35"=100 is invalid and "D36"=200 is invalid


#5

Please try this fix.


#6

I tested a new object.
I found a little bug again.

// ------------------------------------------------------
Excel ex = new Excel();
ex.Open( "SSTMPL2c.XLS" ); // new version

Cells cellSrc = ex.Worksheets[1].Cells;
Range rngSrc1 = cellSrc.CreateRange( 14,0,10,22 );

Cells cellDst = ex.Worksheets[0].Cells;

Range rngDst = cellDst.CreateRange( 30,0,10,22 );
rngDst.Copy( rngSrc1 );

ex.Worksheets[0].Copy( ex.Worksheets[1] );

ex.Save("test.xls", FileFormatType.Default );

// -------------------------------------------------------

Hatching cells( "A15" to "E24" ) of test.xls is different from that of SSTMPL2c.XLS.


#7

Thank you for the report. Please try this attached fix.


#8

Thank you for a fast reply.
My all tests passed it.
I think that my customer evaluates Aspose.Excel highly.