|
|
Comments and Discussions
|
|
 |

|
Thanks a lot.
I was using this component for exporting to OO version 3.2 and Excel 2003
Now:
I recompiled with OO version 3.4 and I have errors exporting to v 3.2
anyway I was not able and I am not able to export to Excel 2010
Does someone have a hint?
modified 9 Oct '12 - 10:33.
|
|
|
|

|
Hi ,
I would like to know if its possible to add two different fonts with two different colours within the same cell..?
If it can be done can you please explain it.
Thanks,
Nirmal
|
|
|
|

|
Hi ,
I would like to know if its possible to set the background colour and font colour to individual cells.
Thanks in Advance..
|
|
|
|

|
Nice....
But, i have problem with source code.
I dont understand with C.
Can you help me to convert the source code to visual basic language ?
Thanks
Asep
|
|
|
|

|
Hi Aleksandr Sazonov and Everybody,
I use project TblProc for export data to file excel and OO in my company.I don't know how to save or SaveCopyAs to folder after i have been data in TableSheet,TableRange(var "page,data" in project TblProc).I want to save to file in folder after open this file beacause i use ASP.NET. You can help me this problem. Thanks so much.
|
|
|
|

|
Hi Aleksandr Sazonov,
the present I use TblProc.Dll in asp.net so that export data to Msexcle. when I run visual studio 2010 then export is successful.But i public for web to a server then not export. You can help me this problem. Thanks so much.
NH
|
|
|
|

|
Hi Aleksandr, you did a great job with this article. Do you know by chance how to paste anything from clipboard on a cell or range? I'm using an existing Calc file as a template. I tried to work like in Excel, sheet.Paste(), writing this with no success:
On OOSheet
public override void Paste(object destination, object link)
{
unoidl.com.sun.star.uno.XComponentContext localContext =
uno.util.Bootstrap.bootstrap();
XMultiComponentFactory multiComponentFactory = (XMultiComponentFactory)
localContext.getServiceManager();
XDispatchHelper dispatchHelper = (XDispatchHelper)
multiComponentFactory.createInstanceWithContext
("com.sun.star.frame.DispatchHelper", localContext);
XFrame frame = _app.GetFrame();
dispatchHelper.executeDispatch((XDispatchProvider)frame, ".uno:Paste", "", 0,
new unoidl.com.sun.star.beans.PropertyValue[0]);
}
On OOApp
public XFrame GetFrame()
{
XFrame frame = ((XModel)_Xdoc).getCurrentController().getFrame();
return frame;
}
I think I need to cast "destination" parameter to XFrame, but this
OOSheet d1 = ((OORange)destination).Page;
XFrame frame = ((XModel)d1).getCurrentController().getFrame();
generates a casting exception...
Any idea?
|
|
|
|

|
Unfortunately no ideas. As OO contains other apps, not only calc, and the apps should have similar structure, maybe OO Write forums search can help you investigate the issue?
|
|
|
|

|
I tried to search for documentation but it's really poor... the aim was to paste the image of a generated barcode. I work-arounded by generating the full barcode string and using a barcode font, but I will face again the problem when I'll need to paste an image from clipboard.
Thanks anyway (still a great job! )
|
|
|
|

|
Hi Aleksandr,
Thanks for your work and examples with OOo and C#. I would appreciate if you have any advice for the following scenario. The user opens an OOo calc spreadsheet, clicks a button that runs a macro. The macro calls an .exe (C#) that grabs data from a sql server and updates the same document that called it. My question is how would I get a reference in the C# to the already opened spreadsheet document? I need to update that spreadsheet in the background without closing, reopen it, so the user experience is just a button click that produces some visible updates.
Best regards,
Mircea
|
|
|
|

|
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
|
|
|
|
 |
|
|
General News Suggestion Question Bug Answer Joke Rant Admin
|
OpenOffice Calc and Excel
| Type | Article |
| Licence | CDDL |
| First Posted | 27 Nov 2007 |
| Views | 68,562 |
| Downloads | 2,981 |
| Bookmarked | 51 times |
|
|