|
|
Comments and Discussions
|
|
 |

|
hi Alexander,
thank you very much for teach me do title in OpenOffice i have done yet. but i have a question other have you help me.I want insert colum ID in OpenOffice not do in datagird.ex: ID Name Address City
1 adam PA PA
2 smith NW NW
3 Alice Mexico MX
.. ..................
column ID which i insert such as ex.thank you
|
|
|
|

|
Exporting data from DataGridView is not the only way for creating a report. For example, you can write your code to export the whole datasource to OO. You can get a TableRange object and set it's cells values using an array.
For example (assuming you have a TablePage page object;
object[,] arr=new object[10,4];
arr[0,0]=1;
arr[0,1]="adam";
arr[0,2]="NW";
arr[0,3]="MX";
//.... and so on. You can fill an array in for or foreach cycle
TableRange rng=page.Range(1,1,10,4); //example coordinates. the first column has #1, the last - #4, so 4 columns
rng.Value=arr;
Or you can get ranges for each cell/row and fill their values. Example:
TableRange rng=page.Range(2,2,2,2);
rng.Value="Hello!";
I didn't test the code, but it should be something like that. You can examine the export code used in the sample to export DataGridView's data to see the third way for exporting data. It's similar to the first way I've shown above, but it uses an "internal" array in the TableRange object to simplify data conversion:
TableRange data = page.Range(page.CurrentRow, 1, page.CurrentRow + nStrings-1, nVisibleCols);
data.CreateArray();
//...filling the array created in TableRange object
//and now put the data to OO (or Excel, it depends on the actual type of page object)
data.FlushArray();
|
|
|
|
 |
|
|
General News Suggestion Question Bug Answer Joke Rant Admin
|
OpenOffice Calc and Excel
| Type | Article |
| Licence | CDDL |
| First Posted | 27 Nov 2007 |
| Views | 68,465 |
| Downloads | 2,976 |
| Bookmarked | 51 times |
|
|