|
|
Comments and Discussions
|
|
 |

|
Sorry, I did no investigation how to deal with already opened documents. But if the opporyunity to connect to an open document exists, it should be shomewhere near Application object.
|
|
|
|

|
Hello
How can i set name of the cell? and get cell from the sheet by cell name.
And how i can start calculation of the formula in the cell?
Thank.
|
|
|
|

|
Sorry, no ideas now. I don't even know what a "cell name" is. I couldn't find good documentation on OOo Calc automation. So I can just describe methods of gaining info about OOO Calc automation internals^
1. As in Excel - record a macro taking actions you need to perform programmatically. If you're lucky, the macro code will contain the code you need - just translate it to C#.
2. Use SA.TblProc.OOEP class (in OOEP.cs file) to view the content of XPropertySet in runtime. There's usually a lot of interesting stuff inside. To use the class write something like
OOEP.Obj=(XPropertySet)cell;
in you code, place a breakpoint to the line
val = xps.getPropertyValue(name).Value;//OOEP.cs
and execute your code in DEBUG mode (with debug TblProc.dll version of course).
|
|
|
|

|
Hi Alexandr,
First Thanks for this demanding article.
My Question is- when run this code in debug mode and do export, It exporting file. But when I deployed it and run the application it not exporting OpenOffice file.
I referenced the files in my project given by u.
using ASP.Net 2,0. OO 3.0.
If missing something then please tell the steps of adding files and setting permission.
Thanks & Regds,
Pawan Kumar
|
|
|
|

|
>But when I deployed it and run the application it not exporting OpenOffice file.
1. Any errors, exceptions?
2. You deployed what - I guess you deployed your own project, which uses TblProc.dll. If I'm right, maybe you can show a piece of of code, which exports data? Or you just deploy the sample?
3. You deployed it where? Is it a network share? Default .NET security policy rejects many operations if the binaries reside on a network share - in such a case you need to sign the code and configure .NET permissions.
|
|
|
|

|
(A) When Application run in VS.net (Server) Environment and produce oo report. It producing Open Office Excel file and Charts. Its OK.
(B) In IIS Server it not produce the file and processing goes endless. Not produce any error / exception.
(C) When wait long for localhost it shows
"An un handeled exception(System.CannotUnloadAppDomainException) occured in aspnet_wp.exp"
======================================================================
What I have done. Open Office 3.0.
1. Added the TblProc.dll as reference in my project.
2. five cli_ files are in GAC
Excluding cli_uno.dll file.
give HResult error when add cli_uno.dll as reference so not added in project and it is not
in GAC and in VS Server without it producing file.
----------------------------------------------------------------------
|
|
|
|

|
Sorry, I have no experience in ASP.net
|
|
|
|

|
Thanks dear for reply.
I appritiate u for coordination.
I will do some more search to find out the solution.
Regds
Pawan Kumar
|
|
|
|

|
I plan to publish update when I'll migrate to OO 3.x
The main difference should be the way how app runs OO. + library references should be updated (AFAIK).
|
|
|
|

|
OK, here's an update of the article. Now the code supports OOo 3.0, not 2.x. I made no tests, but doubtfully it is still compatible with 2.x. Anyway, minor changes can bring it back to support OOo 2.x (and discard compatibility with 3.0 for sure): re-reference .DLLs and, optionally, comment out 1 line in OOApp.cs. Anyway, if this version is not compatible with 2.x, I have no ideas how to make it work with both - 2.x and 3.0.
|
|
|
|

|
Alexandr,
Your solution is exactly what I need, but I downloaded the zip files and they won't open. I'm using WinZip 12 which is the latest version. Has anyone else had this problem?
Thanks,
James
|
|
|
|

|
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();
|
|
|
|

|
hi Alexander,
i want to do report for my company as use OpenOffice Calc.but i don't know how to insert header in OpenOffice for report ex:"BAO CAO KET QUA TTHUE NHA";month:"2008";Location:"HCM CITY".i have done load data from dataset in OO as souce code of you but i haven't done discription as top.i have to you help me to do it.thank you very much
|
|
|
|

|
If you're talking about changing document's properties (such as title, topic, etc., which are under "File->Properties..." menu item) - I don't know how to do it, never thout it can be useful.
Adding a title to the document's content should be quite easy. Assuming you have a sheet - a TableSheet object (in your case it will really be a OOSheet object). To get a TableSheet object you have to get an application object, using TableProcessor's factory methods and then create a sheet using LastPage or CreateNextPage method.
I usually add a header like that:
TableRange header=sheet.Range(sheet.CurrentRow,1,sheet.CurrentRow, nColumns);//nColumns-number of used columns
header.Merge();
header.Value="THE TEXT OF THE TITLE";
header.HAlign=HAlign.Center;
//other header text decoration using "header" varialbe
sheet.PrintRowsOnEachPage(sheet.CurrentRow,sheet.CurrentRow);//every printed page will contain the header
sheet.CurrentRow++;//to use AddArray correctly with other code
I made no tests nor compilation of the code above, but I hope it's really close to what you need
|
|
|
|
|
|

|
Thanks for URL. This may be useful for making simple wrappers for MS Word and OO Write.
As for the Excel and Calc wrappers, I added chart support to the library and hope I will compile and post update soon.
|
|
|
|

|
Hi,
It's nice that can be produced solution based on OO that cost nothing instead of MS Office that is expensive.
Good Job!!! You got my 5.
Good Luck
Alex Kucherenko
|
|
|
|
 |
|
|
General News Suggestion Question Bug Answer Joke Rant Admin
|
OpenOffice Calc and Excel
| Type | Article |
| Licence | CDDL |
| First Posted | 27 Nov 2007 |
| Views | 68,555 |
| Downloads | 2,981 |
| Bookmarked | 51 times |
|
|