[jopendocument] Re: Support in-memory sheets (and documents read from an URL)

2009-05-28 Thread Sylvain Cuaz


Cafebabe a écrit :

The SpreadSheet-API is very File-oriented. I would like to see a way
of reading SpreadSheets from an URL or from an in memory byte array:

SpreadSheet createFromFile = SpreadSheet.createFromUrl( new URL
(url) );

and

byte[] bytes = ...
SpreadSheet createFromFile = SpreadSheet.createFromBytes( bytes );

Or in general an InputStream. This is much more flexible than a File.

SpreadSheet.create( inputStream );

Instead of saveAs() to a File I would like to see an OutputStream

OutputStream  baos = new ByteArrayOutputStream();
sheet.getSpreadSheet().saveAs( baos );


Hi,

For both you need to use ODPackage :
- SpreadSheet.create(new ODPackage(InputStream))
- SpreadSheet.getPackage().save(OutputStream)

HTH,
Sylvain



[jopendocument] Re: adding an image to a document / to a table

2009-05-28 Thread Sylvain Cuaz


Eric Duell a écrit :

Is it possible to add a image to a table cell?


At least I can answer one part my question, after I imported the
source code to my eclipse. Yet it is not able to add a image to a
table cell. According to MutableCell.java -- setValue () only allows
FLOAT and DATES. Of all other Objects is used the toString() as the
value.


	Indeed, but below these you'll find multiple setImage() methods. 
Although in keeping with our template approach an image must be anchored 
to that cell in OpenOffice (to specify how to layout the picture).


HTH,
Sylvain


[jopendocument] Re: Multiple Sheets, Naming Sheets

2009-06-05 Thread Sylvain Cuaz


J McBride a écrit :

Hello,


Hi,


I'm trying to use jOpenDocument to create new spreadsheets for
presenting data.  These spreadsheets need to have multiple sheets
within them.  I can't find any way within the API to create new
sheets.  What I'm looking for is something like SpreadSheet.addSheet
(TableModel data).  Is this possible?  Am I missing something in the
API?


No, it's not possible yet, but we will see to add it.


Also, I would like a way to name the sheets, such as
SpreadSheet.getSheet(0).setName(myName).  Again, is this possible/am
I missing something in the API?


This will be added in the next version.

Cheers,
Sylvain



[jopendocument] Re: Problem to reopen saved spreadsheet documents

2009-07-28 Thread Sylvain Cuaz


googleuser a écrit :

Hello,


Hi,


i use the jOpenDocument library to save and open OpenOffice
spreadsheets. I have the problem
that saved data created with the library cannot be reopened with the
library.


Yes, there was a NPE in ODPackage.getDocument(). It is now fixed, you 
should be able to reopen saved documents with the next beta release 
(hopefully this week).


Cheers,
Sylvain


[jopendocument] Re: How to create a chart ?

2009-10-05 Thread Sylvain Cuaz


Guillaume Viguier-Just a écrit :

Hi,

However, I've seen the chart package, but I can't figure out how to
create a chart based on the data I have in my spreadsheet, and then
include this chart within the spreadsheet. Is it possible to do that ?


No for the moment the chart package is not able to generate XML.


Cheers,
Sylvain


[jopendocument] Re: New line in sheet cell

2009-11-12 Thread Sylvain Cuaz


Alfredo a écrit :

Hello:

I'm trying to use JOpenDocument and I found a problem: When I get
string from open document sheet cell, method SpreadSheet.getValueAt
return only text until first new line of the cell text.

Is this normal behaviour?


Hi,

	No, thanks for reporting, it's just I had not looked at the standard to 
know how to handle all cases. I've committed the fix for getValueAt() 
and added Cell.getTextValue() to retrieve the formatted output of a cell 
(like a date).


HTH,
Sylvain



Re: [jopendocument] Cell Comment

2010-12-14 Thread Sylvain Cuaz

Le 01/12/2010 17:24, abad a écrit :

Ho to read a cell comment using the API?


Hi,

There's no support in the API but it's quite simple :

Cell? cell = sheet.getCellAt(A3);
XMLVersion version = sheet.getODDocument().getVersion();
Element annot = cell.getElement().getChild(annotation, 
version.getOFFICE());
String comment = annot.getChild(p, version.getTEXT()).getText();

HTH,
Sylvain


Re: [jopendocument] hideSection not works

2010-12-14 Thread Sylvain Cuaz

Le 13/12/2010 11:10, Boymix81 a écrit :

Hi,

I want management the visibility of some sections in a odt document .
In jopendocument library I only find showParagraph and hideParagraph
methods in org.jopendocument.dom.template.JavaScriptFileTemplate
class .

I extend this class with the following methods :

 public void showTable(String name) {
 this.setField(showTable_ + name, Boolean.TRUE);
 }
 public void hideTable(String name) {
 this.setField(showTable_ + name, Boolean.FALSE);
 }

 public void showSection(String name) {
 this.setField(showSection_ + name, Boolean.TRUE);
 }
 public void hideSection(String name) {
 this.setField(showSection_ + name, Boolean.FALSE);
 }

 public void showListItem(String name) {
 this.setField(showListItem_ + name, Boolean.TRUE);
 }
 public void hideListItem(String name) {
 this.setField(showListItem_ + name, Boolean.FALSE);
 }

but for section element the methods don't work and I have the
following error :


Hi,

Could you provide your java code, your template and the whole stack trace so we 
can look into it ?

Cheers,
Sylvain


Re: [jopendocument] Merge mutiple text files: page break question

2011-05-10 Thread Sylvain Cuaz

Le 08/03/2011 15:30, fiensi73 a écrit :

Hello,
I'm trying JOpenDocument library for a project involving complex mail
merge with JODReports.
I've got 2 questions:

1) Is there a way of creating a new text document? Something like
SpreadSheet.createEmpty(model).saveAs(file)?


No, but you can do something like
new ODPackage(getClass().getResourceAsStream(myEmpty.odt)).toSingle()


2) I used the method ODSingleXMLDocument.add(ODSingleXMLDocument doc,
boolean pageBreak) trying to have no page break between documents
setting pageBreak = false, but It doesn't seem to work. There
something I make wrong?


	No, this is how it works. Check in OpenOffice if the last paragraph of the first document doesn't 
specify a page break after itself.



Cheers,
Sylvain


Re: [jopendocument] Managing thousand of records with Spreadsheet class for ods files

2012-03-23 Thread Sylvain Cuaz

Le 19/03/2012 15:10, manisha a écrit :

Hi,
I am using Spreadsheet.createFromFile(new File(curser.ods)) method to
loas spread sheet object.
curser.ods can have five sheets in which each sheet consists of 1
records. When try to load this file, consuming maximum time(say 2 mins...)
and even memory wise consuming ion GB's.


Hi,
could you try with the latest version ?

http://www.jopendocument.org/download/jOpenDocument-1.3b1.jar

Cheers,
Sylvain




Re: [jopendocument] How can i read cell which contains multiple lines?

2012-05-04 Thread Sylvain Cuaz

Le 04/05/2012 13:40, gammoudi neji a écrit :

Hello,


Hi,


I have a method which read all records from an input .ods file, It works
well especially for multi-line cell.
For multi-line cell i get only the first line and not all the content.


It should work, can you provide your .ods file.

Cheers,
Sylvain


Re: [jopendocument] Re: How can i read cell which contains multiple lines?

2012-05-07 Thread Sylvain Cuaz

Le 07/05/2012 11:01, gammoudi neji a écrit :

As you can see only multi-lines cell are not all displayed!
Have you modified the exemple.ods file before run the test?


No, what version of jOpenDocument are you running ? I think the support for multi-line was added in 
1.2. Otherwise try with the 1.3b1.


Cheers,
Sylvain


Re: [jopendocument] Google Docs cannot import spreadsheet created by JOpenDocument.

2013-02-28 Thread Sylvain Cuaz

Le 26/02/2013 17:05, Daniel Lopez Gonzalez a écrit :

Hello

Hi


am trying to use the jOpenDocument library http://www.jopendocument.org/ to 
create documents. I
have executed the example where it creates a spreadsheet - the code compiles 
and runs OK but when
I tried to open the document with Google Docs they indicated to me that the 
format is incorrect.


Indeed, Google freaks out if an automatic style name isn't all lower case. And it uses false as the 
default for the displayability of tables. The rc2 version will include an explicit display=true.


Cheers,
Sylvain

--

--- 
You received this message because you are subscribed to the Google Groups jOpenDocument group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to jopendocument+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [jopendocument] Open Document - How to remove rows from a sheet?

2013-04-04 Thread Sylvain Cuaz

Le 26/03/2013 22:38, Barry Williams a écrit :

In using a spreadsheet template, I have inserted all the rows necessary in
the template itself.  I then call for the file in opendocument
spreadsheet.  The data I pass to the spreadsheet does not necessarily need
all the data rows that were set, and therefore I would like to remove the
unused rows.  I have searched for remove rows or delete rows and find no
api for that task.  What am I missing?


	Nothing, we never needed it so it didn't exist. But I added Table.removeRows() yesterday, it will 
be in the next release.


Cheers,
Sylvain

--

--- 
You received this message because you are subscribed to the Google Groups jOpenDocument group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to jopendocument+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [jopendocument] jOpenDocument cannot write booleans

2013-04-04 Thread Sylvain Cuaz

Le 02/04/2013 23:26, PhilipN a écrit :

Hi,


Hi,


I found that using jOpenDocument (even 1.3rc1) it is not possible to write
boolean values to a spreadsheet.
I suspect part of the issue that jOpendocument doesn't write the proper
office:value-type tag in the table cells.

AFAICS office-value-type fields aren't written for other cell contents
types either:  text,  data,  time, ..
I only see office:value-type:float tags in jOpenDocument-generated table
cells.


Until 1.2, only string, float and date were supported. Since 1.3, setValue() can infer the type from 
the value, or one can pass an ODValueType.



public static void main(String[] args) throws IOException {
final Sheet sheet = SpreadSheet.create(1, 3, 3).getFirstSheet();
sheet.getCellAt(A1).setValue(On site support);
sheet.getCellAt(A2).setValue(new Date());
sheet.getCellAt(A3).setValue(TimeUtils.getTypeFactory().newDuration(P2DT26H30M11S), 
ODValueType.TIME, false, false);

sheet.getCellAt(B1).setValue(3);
sheet.getCellAt(B2).setValue(0.3, ODValueType.PERCENTAGE, false, 
false);
sheet.getCellAt(B3).setValue(true);

OOUtils.open(sheet.getSpreadSheet().saveAs(new File(out)));
}

If you unzip out.ods, you will see the proper value-type attributes are 
generated.



It also strikes me that all table-cells in a spreadsheet created with
jopendocument contain the tag:
  xmlns:text=*urn:oasis:names:tc:opendocument:xmlns:text:1.0*
Isn't this an enormous waste of JVM memory, or even disk memory, as this
info is repeatedly present in memory for each cell once the spreadsheet
file is unpacked?
Or is this tag only generated when jopendocument objects are exported from
the Java world?


	In memory the same instance of Namespace is used by JDOM. If JDOM exports it for each cell it means 
no common XML element ancestor defines it. It might have happened in 1.2 (though the workaround is 
simple), but in 1.3 this can no longer happen since the root element defines it.




Thanks,

Philip



Cheers,
Sylvain


--

--- 
You received this message because you are subscribed to the Google Groups jOpenDocument group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to jopendocument+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [jopendocument] Read and Edit a existing ods file in open state

2013-04-11 Thread Sylvain Cuaz

Le 10/04/2013 12:00, Ruben Cabral a écrit :

hi there,
I try read and modify an existing spreadsheet, and save it but i need the
ods file stay all the time open, is realy necessary, and my code is like
this for example.

File file = *new *File(template/invoice.ods);
*final *Sheet sheet = SpreadSheet.createFromFile(file).getSheet(0);

sheet.getCellAt(I10).setValue(*hello*);

sheet.getSpreadSheet().saveAs(File);

But with this code give me a error maybe because the file is already open.
It's possivel with jopendocument api make this?


Hi,

	No, it's the OS that's refusing to write to an open file, nothing Java can do about it. The only 
way would be to connect the running instance of Office using UNO and tell it to change the value.


Cheers,
Sylvain



--

--- 
You received this message because you are subscribed to the Google Groups jOpenDocument group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to jopendocument+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [jopendocument] Re: IllegalArgumentException : Cannot get sheets from an ODS file

2013-06-24 Thread Sylvain Cuaz

Le 23/06/2013 13:38, Michal Rajčan a écrit :

Good day,
I just want to ask, if you have solved your problem? If so, how?
I need to do the same task and my project stopped with this same error as
yours and i have no idea, how to fix it.


Hi,

	As I've said before, it seems that the file isn't valid. If you could send the file so that I can 
take a look.


Cheers,
Sylvain

--

--- 
You received this message because you are subscribed to the Google Groups jOpenDocument group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to jopendocument+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [jopendocument] Templating doesnt work. EngineTemplate::saveAs creates strange output ?!?

2013-06-25 Thread Sylvain Cuaz

Le 24/06/2013 18:12, kugelphan...@googlemail.com a écrit :

Hi everyone!



Hi,



I'm new to jOpenDocument and try to get the TestTemplate.java example
from the sources to work (for the last 8 hours :-//).

It compiles ok, and runs also. But this:

 // Save to file.
 template.saveAs(outFile);

does not create the out.odt file as expected, but an out.odt.fodt wich
is either not complete, or in any other form  broken,
as oo opens it as xml text.

I tried 32bit JDK 7, aswell as JDK 6. I tried the 1.2 sources and they
work.


	Yes, it's a bug in 1.3 (it will be fixed in the next version). The file generated is correct, but 
as you saw it's a flat XML (which LibreOffice has no problem opening, unless you have an ancient 
OpenOffice version) and not a zip package. If you do want the zip package form you can call 
template.createDocument().saveToPackageAs(outFile).


Cheers,
Sylvain

--

--- 
You received this message because you are subscribed to the Google Groups jOpenDocument group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to jopendocument+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [jopendocument] src/org/jopendocument/examples/SimpleOdt2.java

2013-08-01 Thread Sylvain Cuaz

Le 24/07/2013 09:50, Gmail a écrit :

Hi,

ok fine,

This code does not work anymore :

ODPackage outputDocument = new ODPackage(new File(styles.odt));
contentDom = outputDocument.toSingle();
final Paragraph paragraph = new Paragraph();
contentDom.add(paragraph);

What is the correct way to do it in version 1.3 ?


The add() method is now in TextDocument. So your second line should be

TextDocument contentDom = outputDocument.getTextDocument();


HTH,
Sylvain

--

--- 
You received this message because you are subscribed to the Google Groups jOpenDocument group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to jopendocument+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [jopendocument] Conditional text

2013-08-01 Thread Sylvain Cuaz

Le 31/07/2013 10:09, Jenthe Marien a écrit :

Hi

I'm developing my first project using jOpenDocument.

Is there some way to put Conditional Text in my OpenOffice template as I
would do using the OpenOffice api?


Hi,

Install the addon and see http://www.jopendocument.org/start_text_2.html
If you want a conditional text, you can insert a field and then call 
setField()
If you want a conditional paragraph, you can tag it and then call 
hideParagraph()

Cheers,
Sylvain

--

--- 
You received this message because you are subscribed to the Google Groups jOpenDocument group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to jopendocument+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [jopendocument] Re: IllegalArgumentException : Cannot get sheets from an ODS file

2013-08-27 Thread Sylvain Cuaz

Le 24/06/2013 09:34, Sylvain Cuaz a écrit :

Le 23/06/2013 13:38, Michal Rajčan a écrit :

Good day,
I just want to ask, if you have solved your problem? If so, how?
I need to do the same task and my project stopped with this same error as
yours and i have no idea, how to fix it.


Hi,

 As I've said before, it seems that the file isn't valid. If you could send 
the file so that I
can take a look.


Hi all,

	One of our customers had a file causing the same exception as Douglas and Michal. The problem was 
easy to spot once I had a look at the file : a file created by LibreOffice (or jOpenDocument) and 
then modified by Microsoft Office will contain files with mixed versions (or more precisely with 1.1 
and null versions). The next version of jOpenDocument will handle this.


Cheers,
Sylvain

--

--- 
You received this message because you are subscribed to the Google Groups jOpenDocument group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to jopendocument+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [jopendocument] Perm Gen out of memory problem with JOpenDocument 3

2013-09-05 Thread Sylvain Cuaz

Le 09/08/2013 10:17, FL a écrit :

Hello,

In my application Java, I have a tool of migration which allows me to push
towards CouchDB (No-SQL DB) in JSON (Jackon), XML(JAXB), and PDF format
corresponding to these folders (POJOs/Object Java).

In the 500th iteration (approximately) the memory PermGen is saturated, and
the JVM is blocked(surrounded). It is necessarily necessary to restart the
JBoss server ...
We analyzed the evolution of the memory with JConsole (of the jdk) and also
JProfiler 8 = leak og PermGen memory ...
It would seem that JOpenDocument is not adapted in batch processing.


	Well, jOpenDocument has been used in production for many years, with long running processes and we 
never saw an OutOfMemoryError.



Here is a result of our UnitTest :

*The unit test :*

@Test
 public void testDeCharge() throws DouaneException, JDOMException,
TemplateException, IOException {

.

 }


This doesn't give more information about your problem. And since it's incomplete no one can try to 
replicate your problem. I've attached a test, when I run it in jProfiler no objects of jOpenDocument 
remains in memory at the end (except some static constants) and the total JVM memory is 1.1 MB.




*The console output : *

java.lang.OutOfMemoryError: PermGen space
 at 
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
 at 
com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
 at org.jdom.input.SAXBuilder.build(SAXBuilder.java:518)
 at org.jdom.input.SAXBuilder.build(SAXBuilder.java:865)
 at org.jopendocument.dom.ODPackage$1.processEntry(Unknown Source)
 at org.jopendocument.util.ZippedFilesProcessor.process(Unknown Source)
 at org.jopendocument.dom.ODPackage.init(Unknown Source)
 at org.jopendocument.dom.template.Template.init(Unknown Source)
 at org.jopendocument.dom.template.RhinoStreamTemplate.init(Unknown 
Source)
 at 
fr.gouv.finances.douane.banaco.edition.dossier.DossierExAnteEdition.getSelectedTemplate(DossierExAnteEdition.java:45)
 at 
fr.gouv.finances.douane.banaco.edition.dossier.DossierEdition.editer(DossierEdition.java:214)
 at 
fr.gouv.finances.douane.banaco.edition.dossier.DossierTest.testDeCharge(DossierTest.java:124)


There's RhinoStreamTemplate in your stack trace, meaning you don't use jOpenDocument 1.3 but an 
older one. Also the part where the JRE runs out of memory and the part that's causing the leak may 
not be the same.



Heve you an idea ?


You could either provide a minimal runnable sample of your code exhibiting the leak. Or since the 
code is apparently for the french customs and might need the commercial licence, buy one.



Cheers,
Sylvain

--

--- 
You received this message because you are subscribed to the Google Groups jOpenDocument group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to jopendocument+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
/*
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
 * 
 * Copyright 2008 jOpenDocument, by ILM Informatique. All rights reserved.
 * 
 * The contents of this file are subject to the terms of the GNU General Public 
License Version 3
 * only (GPL). You may not use this file except in compliance with the 
License. You can obtain a
 * copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the 
License for the specific
 * language governing permissions and limitations under the License.
 * 
 * When distributing the software, include this License Header Notice in each 
file.
 */

package org.jopendocument.sample;

import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.jopendocument.dom.OOUtils;
import org.jopendocument.dom.template.EngineTemplate;
import org.jopendocument.dom.template.RhinoTemplate;

public class TestTemplate {

public static void main(String[] args) {
try {
File templateFile = new File(template/test.odt);
File outFile = new File(out.odt);

final ListMapString, String months = new ArrayListMapString, 
String();
months.add(createMap(January, -12, 3));
months.add(createMap(February, -8, 5));
months.add(createMap(March, -5, 12));
months.add(createMap(April, -1, 15));
months.add(createMap(May, 3, 21));

for (int i = 0; i  200; i++) {
// Load the template.
EngineTemplate template = new RhinoTemplate(templateFile);

// Fill with sample values.
template.setField(toto, value set using setField());
template.setField(months, months);

template.hideParagraph(p1);
template.hideSection(section1);

// Save to file.
template.saveAs(outFile);
 

Re: [jopendocument] Google Docs cannot import spreadsheet created by JOpenDocument.

2013-10-11 Thread Sylvain Cuaz

Le 08/10/2013 16:14, Alex Buloichik a écrit :



On Thursday, February 28, 2013 6:34:36 PM UTC+3, ILM wrote:



Indeed, Google freaks out if an automatic style name isn't all lower case.
And it uses false as the
default for the displayability of tables. The rc2 version will include an
explicit display=true.



I tried with the  jopendocument -1.3.jar. The same issue. But when I open
ods file, then insert space into one empty cell, then save ods, then Good
opens it good.
I have to change every sheet in ods file for impot to Google Docs.


Hi,

	I tried just now with org.jopendocument.sample.SpreadSheetCreation and SpreadSheetFill to import to 
google drive and both worked flawlessly. Can you send an ods that doesn't work ?


Cheers,
Sylvain

--

--- 
You received this message because you are subscribed to the Google Groups jOpenDocument group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to jopendocument+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [jopendocument] Google Docs cannot import spreadsheet created by JOpenDocument.

2013-10-18 Thread Sylvain Cuaz

Le 12/10/2013 09:22, Alex Buloichik a écrit :

Hi Sylvain !

See attachment, please.


OK, it's the same issue : Google is missing display=true. Upon investigating this can happen in 1.3 
if you use SpreadSheet.addSheet(). As a workaround you can either create all your sheets at once 
using SpreadSheet.create(int sheetCount, int colCount, int rowCount) or use createEmpty() and then 
Sheet.copy().

This will be resolved in the next release.

Cheers,
Sylvain

--

--- 
You received this message because you are subscribed to the Google Groups jOpenDocument group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to jopendocument+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [jopendocument] Issue with SchemaFactory

2013-10-21 Thread Sylvain Cuaz

Le 19/10/2013 06:21, Alex Buloichik a écrit :

Hi !

Probably it's not an jOpenDocument's issue, but my configuration issue.

I just included jOpenDocument-1.3.jar into classpath, then try to work with
xsd schemas:

SchemaFactory factory =
SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);

Exception is:

Exception in thread main java.lang.NoClassDefFoundError:
org/iso_relax/verifier/VerifierConfigurationException


It is indeed specified by jOpenDocument : META-INF/services/javax.xml.validation.SchemaFactory 
contains org.iso_relax.verifier.jaxp.validation.RELAXNGSchemaFactoryImpl which needs 
VerifierConfigurationException. To solve this you could either
1. as specified in the README add msv.jar, relaxngDatatype.jar, xsdlib.jar and isorelax.jar from 
http://java.net/downloads/msv/releases/msv.20090415.zip which would allow you to use 
ODPackage.validateSubDocuments()

2. define the system property 
javax.xml.validation.SchemaFactory:http://relaxng.org/ns/structure/1.0;
3. remove the javax.xml.validation.SchemaFactory file from the jar

Cheers,
Sylvain

--

--- 
You received this message because you are subscribed to the Google Groups jOpenDocument group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to jopendocument+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [jopendocument] jOpenDocument Sheet.getValueAt(int, int) return value is both a String and a BigDecimal?

2013-10-29 Thread Sylvain Cuaz

Le 18/10/2013 22:41, Florrie O. a écrit :



I'm processing a .ods spreadsheet with the jOpenDocument library. Since I
was processing strings, everything was ok, but when it comes to process
numbers it's a pain.

In my code I iterate the spreadsheet and make some computations based on
the value assumed by the cell at index x,y. Surprisingly enough, I can't
get the class of the values I get:


BigDecimal ferialestringa;
  while (true) {
 boolean duplicate = false;
 value = (String) sheet.getValueAt(0, count);
 System.out.println(sheet.getValueAt(5, 
count).getClass());
 ferialestringa = (BigDecimal) sheet.getValueAt(5, 
count);

This snippet prints out:



class java.math.BigDecimalclass java.lang.StringException in thread main 
java.lang.ClassCastException: java.lang.String cannot be cast to java.math.BigDecimal
 at InspectTwitter.main(InspectTwitter.java:78)

You can see that the value appears to belong to two different classes.


I see that during the first evaluation of the loop the cell at (5,count) contains a BigDecimal ; the 
second time the cell at (5,count) contains a String.



If I try to parse the returned object to a string, I get also another
ClassCastException:


class java.math.BigDecimalException in thread main 
java.lang.ClassCastException: java.math.BigDecimal cannot be cast to java.lang.String
 at InspectTwitter.main(InspectTwitter.java:78)

Note that this time the class seems to be just BigDecimal.


This is coherent since the first time the loop has indeed a BigDecimal.


I tried to find documentation but only Sheet.getValueAt(String) is
available on this http://www.jopendocument.org/docs/index.html javadoc.
(I've found this method in tutorials though, and it seems to be working
very well on strings). What should I do?


From what I can tell, getValueAt() is working correctly ; you should verify your coordinates and 
the content of the cells (e.g. maybe the content of a cell looks like a number but is defined as 
string).



Cheers,
Sylvain

--

--- 
You received this message because you are subscribed to the Google Groups jOpenDocument group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to jopendocument+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [jopendocument] ant build fails with name clash on debian

2014-06-20 Thread Sylvain Cuaz

Le 17/06/2014 17:15, Manfred Hanke a écrit :


Hi,

I also got that error and once resolved it with the following patch:


Hi,

I've also renamed it in the trunk, it will be in the next release.

Cheers,
Sylvain


--

--- 
You received this message because you are subscribed to the Google Groups jOpenDocument group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to jopendocument+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [jopendocument] add clean target to build.xml

2014-06-26 Thread Sylvain Cuaz

Le 20/06/2014 20:28, Pirate Praveen a écrit :

I thought it would be useful to share it here.


Thanks, it will be in the next release.

Cheers,
Sylvain

--

--- 
You received this message because you are subscribed to the Google Groups jOpenDocument group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to jopendocument+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [jopendocument] Fwd: Re: libjopendocument-java build failures after repack

2014-06-26 Thread Sylvain Cuaz

Le 20/06/2014 20:25, Pirate Praveen a écrit :


heads up for java 8 compatibility.



According to:

http://anonscm.debian.org/viewvc/pkg-java/trunk/libcommons-collections3-java/debian/patches/java8-compatibility.patch?view=markup

MultiHashMap.remove has been renamed to MultiHashMap.removeMapping so
adding a patch with:

@@ -196,7 +196,7 @@ public class CollectionMapK, V extends
MultiHashMap {

  public void removeAll(Map? extends K, ? extends V m) {
  for (final Map.Entry? extends K, ? extends V e :
m.entrySet()) {
-this.remove(e.getKey(), e.getValue());
+this.removeMapping(e.getKey(), e.getValue());
  }
  }

should help.


This class is no longer needed, it won't be in the next release.

Cheers,
Sylvain

--

--- 
You received this message because you are subscribed to the Google Groups jOpenDocument group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to jopendocument+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [jopendocument] comments in french needs an explicit encoding setting in non-utf-8 locales

2014-06-26 Thread Sylvain Cuaz

Le 21/06/2014 09:21, Pirate Praveen a écrit :

I think it would be a goog idea to set encoding to utf-8 explicitly so
it can build fine in non-utf-8 locales as well.


Agreed, I've patched build.xml

Cheers,
Sylvain

--

--- 
You received this message because you are subscribed to the Google Groups jOpenDocument group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to jopendocument+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [jopendocument] Re: .fods (flat xml) support

2015-04-17 Thread Sylvain Cuaz

Le 16/04/2015 21:07, Adam Brousseau a écrit :

Not sure if anyone knows that answer, but I am still interested in this
functionality.


Hi,

	If you're sure that it's a flat XML, you can use ODSingleXMLDocument.createFromFile() / 
createFromStream(). Otherwise ODPackage.createFromFile() / createFromStream() will work for the 
zipped and flat formats (then call getSpreadSheet()).


Cheers,
Sylvain

--

--- 
You received this message because you are subscribed to the Google Groups jOpenDocument group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to jopendocument+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [jopendocument] spreadsheet range

2016-06-15 Thread Sylvain Cuaz

Le 06/06/2016 14:59, James Pollard a écrit :



Hi, I'm trying to workout how to select a range of cells then change the 
background colour
This is what I've tried so far as well as variations of this

inSheet.getCellAt("Sheet1.".concat((startPoint.concat(":")).concat(endPoint))).setBackgroundColor(Color.green);

I'm assuming I've tried doing it the wrong way

Any help pointing me in the right direction would be appreciated
James


Hi,

You must iterate on each cell :

final Range r = Range.parse(rangeString);
for (int y = r.getStartPoint().y; y <= r.getEndPoint().y; y++) {
for (int x = r.getStartPoint().x; x <= r.getEndPoint().x; x++) {
getCellAt(x, y).setBackgroundColor(color);
}
}

Cheers,
Sylvain

--

--- 
You received this message because you are subscribed to the Google Groups "jOpenDocument" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to jopendocument+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [jopendocument] getRange and getTableModel returning null

2017-04-12 Thread Sylvain Cuaz

Le 11/04/2017 à 08:33, rho...@opentrends.net a écrit :

Hi, I have defined a named range in my libreoffice ods, but neither getRange 
nor getTableModel seem
to get it, they both return null, do you know what could cause that behavior?


Hi, from your screenshot it appears you have created a database range not a named range. To name 
range, simply replace the coordinates (the text field with "A1:B2") by a name and hit enter. To 
manage names open the combobox.



 System.out.println(String.valueOf(sheetInfo.getSpreadSheet().getRange("int")));


Be aware that there's sheet ranges and global ranges, the former is returned by Sheet.getRange() the 
latter by SpreadSheet.getRange().


Cheers,
Sylvain

--

--- 
You received this message because you are subscribed to the Google Groups "jOpenDocument" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to jopendocument+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [jopendocument] jOpenDocument can't read text cells created by libreoffice 7.0.1

2020-09-14 Thread Sylvain Cuaz

Le 31/08/2020 à 21:41, bdw...@gmail.com a écrit :

There's an error in my description of the problem.

x.getValue() and  x.getTextValue() do not return null.  They throw 
NullPointerExceptions. E.g.

Exception in thread "main" java.lang.NullPointerException
    at org.jopendocument.dom.text.TextNode.getCharacterContent(Unknown Source)
    at org.jopendocument.dom.text.TextNode.getChildrenCharacterContent(Unknown 
Source)
    at org.jopendocument.dom.text.TextNode.getChildrenCharacterContent(Unknown 
Source)
    at org.jopendocument.dom.spreadsheet.Cell.getTextValue(Unknown Source)
    at org.jopendocument.dom.spreadsheet.Cell.getTextValue(Unknown Source)
    at org.jopendocument.dom.spreadsheet.Cell.getTextValue(Unknown Source)
    at org.jopendocument.dom.spreadsheet.Cell.getValue(Unknown Source)
    at test.ODSTEst.main(ODSTEst.java:35)

On Monday, August 31, 2020 at 2:58:02 AM UTC-7 guillaume.maill...@gmail.com 
wrote:

Hi,

Could you provide us the smallest document having this issue in order to 
investigate
and to make it works on the next jOpenDocument version?

Thanks.

Guillaume

Le lun. 31 août 2020 à 11:55, bdw...@gmail.com  a écrit :

I've encountered a surprising problem using jOpenDocument to read ods 
file created by
libreoffice calc version 7.0.1:  the contents of text cells are 
returned as null.

I've been using jOpenDocument to read ods files for years and have 
never encountered any
problems before.

E.g. I have an ods file with text in cell 0,0 of the first sheet, which 
I access with:

    File ods = new File("some_file.ods");
    SpreadSheet spreadSheet = SpreadSheet.createFromFile(ods);
    Sheet sheet = spreadSheet.getFirstSheet();
    MutableCell x = sheet.getCellAt(0,0);

Then
    x.isValid(); // returns true
    x.isEmpty(); // returns false
    x.getValueType(); // returns STRING

/But/
/
/
    x.getValue(); // returns null
    x.getTextValue(); // returns null

This problem turned up when I upgraded to libreoffice 7.01, specifically
1:7.0.1~rc1-1~bpo10+1 amd64. It occurs in any file created /or opened 
/by libreoffice calc
version 7.0.1

FYI I'm using jOpenDocument-1.4rc2 on a debian 10 (buster) system.

Reverting to version 1.6.5-3 (1:6.1.5-3+deb10u6) solves the problem.  
In fact, a file
created with version 7.01 that has subsequently been opened with 
version 1.6.5-3 is readable.

The problem does not occur reading 'float' cells.  I have not tested 
other cell types.

Does anyone have any idea what might be causing a problem like this?


Hi,

    Yes, LO 7 switched to OpenDocument 1.3. We're working on supporting it. In the mean time, you 
can change the format to "1.2 extended". Go to Options, then Load/Save, then General, then ODF 
format version.


Cheers,

Sylvain

--

--- 
You received this message because you are subscribed to the Google Groups "jOpenDocument" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to jopendocument+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jopendocument/1ce6a68f-97fc-3830-317b-bfdeadd5bd33%40ilm-informatique.fr.