How to copy cell format to a new cell
Posted: Tue Nov 03, 2009 4:34 pm
Hello,
I have a cell which has a specific format and I would like to copy the format to a new cells.
The cell contains basically a bunch of text. The text is multi-line.
The first 50 rows in my sheet is formated as follows:
E.g.
========================================================
This is a sample for Axolot
This format is basically for demonstration
text
text
text
========================================================
I tried using the following command, but it does not work.
XLS.CopyCells(ACurrSheet,2,2,2,2,ACurrSheet,2,AIndex,[ccoAdjustCells,ccoForceAdjust,ccoCopyCondFmt]);
I saw a sample before in a thread called "Copy cell-format-settings to a new cell" and it says to use the Assign method, but using the method is not possible:
XLS.Sheets[0].Cell[0,0].Assign(XLS.Sheets[0].Cell[2,2]); .
I also tried also the following code but I get access violation when assigning the second cell in my loop:
XLS.Sheet[ACurrSheet].Cell[2,AIndex].Format.Assign(XLS.Sheets[ACurrSheet].Cell[2,2].Format);
So, after all, how can I copy the the formats from another cell?
Thanks,
Fabio
I have a cell which has a specific format and I would like to copy the format to a new cells.
The cell contains basically a bunch of text. The text is multi-line.
The first 50 rows in my sheet is formated as follows:
E.g.
========================================================
This is a sample for Axolot
This format is basically for demonstration
text
text
text
========================================================
I tried using the following command, but it does not work.
XLS.CopyCells(ACurrSheet,2,2,2,2,ACurrSheet,2,AIndex,[ccoAdjustCells,ccoForceAdjust,ccoCopyCondFmt]);
I saw a sample before in a thread called "Copy cell-format-settings to a new cell" and it says to use the Assign method, but using the method is not possible:
XLS.Sheets[0].Cell[0,0].Assign(XLS.Sheets[0].Cell[2,2]); .
I also tried also the following code but I get access violation when assigning the second cell in my loop:
XLS.Sheet[ACurrSheet].Cell[2,AIndex].Format.Assign(XLS.Sheets[ACurrSheet].Cell[2,2].Format);
So, after all, how can I copy the the formats from another cell?
Thanks,
Fabio