You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openoffice.apache.org by bu...@apache.org on 2016/02/10 14:06:47 UTC

[Issue 126837] New: exporting date values from lotus notes to Calc doesn't work

https://bz.apache.org/ooo/show_bug.cgi?id=126837

          Issue ID: 126837
        Issue Type: DEFECT
           Summary: exporting date values from lotus notes to Calc doesn't
                    work
           Product: App Dev
           Version: 4.2.0-dev
          Hardware: PC
                OS: Windows 7
            Status: UNCONFIRMED
          Severity: Normal
          Priority: P5 (lowest)
         Component: api
          Assignee: issues@openoffice.apache.org
          Reporter: taniagar@in.ibm.com

I'm Lotus notes application developer trying to export data from a lotus notes
application to OpenOffice calc.

all the text values are properly exported, but not the dates.

once exported all the date values get converted automatically to text. 

Do you have any other code to export dates? anything else I should do to ensure
the date vales remain in the same format?

-- 
You are receiving this mail because:
You are the assignee for the issue.

[Issue 126837] exporting date values from lotus notes to Calc doesn't work

Posted by bu...@apache.org.
https://bz.apache.org/ooo/show_bug.cgi?id=126837

--- Comment #4 from orcmid <or...@apache.org> ---
(In reply to orcmid from comment #3)
> (In reply to taniagar from comment #2)
> > (In reply to damjan from comment #1)
> > > Please explain how you are exporting them. Copy and paste? Save to a file
> > > (which format)? Some API? Which code are you using?
> > 
> > Hi, I'm saving data to a file using Lotus Notes application code. This is
> > the code Im using:
> > 
> > Sub Click(Source As Button)
> [ ... ]
> 
> This is not the place for support in writing your Lotus Notes code.
> 
> Since you are writing the data to a file, what we can help you with is the
> format of the file.  Are you making a .csv for import into OpenOffice Calc? 
> That would be the obvious thing.  
> 
> What is the nature of the file you are producing?

It looks from your code that you're trying to use automation to send the data
to Calc directly and having Calc make the file.  

How about making a file instead and importing that into Calc?  It will be much
easier to debug [;<).

-- 
You are receiving this mail because:
You are the assignee for the issue.

[Issue 126837] exporting date values from lotus notes to Calc doesn't work

Posted by bu...@apache.org.
https://bz.apache.org/ooo/show_bug.cgi?id=126837

mroe <mr...@gmx.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |CLOSED

-- 
You are receiving this mail because:
You are the assignee for the issue.

[Issue 126837] exporting date values from lotus notes to Calc doesn't work

Posted by bu...@apache.org.
https://bz.apache.org/ooo/show_bug.cgi?id=126837

orcmid <or...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |orcmid@apache.org

--- Comment #3 from orcmid <or...@apache.org> ---
(In reply to taniagar from comment #2)
> (In reply to damjan from comment #1)
> > Please explain how you are exporting them. Copy and paste? Save to a file
> > (which format)? Some API? Which code are you using?
> 
> Hi, I'm saving data to a file using Lotus Notes application code. This is
> the code Im using:
> 
> Sub Click(Source As Button)
[ ... ]

This is not the place for support in writing your Lotus Notes code.

Since you are writing the data to a file, what we can help you with is the
format of the file.  Are you making a .csv for import into OpenOffice Calc? 
That would be the obvious thing.  

What is the nature of the file you are producing?

-- 
You are receiving this mail because:
You are the assignee for the issue.

[Issue 126837] exporting date values from lotus notes to Calc doesn't work

Posted by bu...@apache.org.
https://bz.apache.org/ooo/show_bug.cgi?id=126837

--- Comment #7 from orcmid <or...@apache.org> ---
(In reply to taniagar from comment #5)
> (In reply to orcmid from comment #4)
> > (In reply to orcmid from comment #3)
> > > (In reply to taniagar from comment #2)
> > > > (In reply to damjan from comment #1)
> > > > > Please explain how you are exporting them. Copy and paste? Save to a file
> > > > > (which format)? Some API? Which code are you using?
> > > > 
> > > > Hi, I'm saving data to a file using Lotus Notes application code. This is
> > > > the code Im using:
> > > > 
> > > > Sub Click(Source As Button)
> > > [ ... ]
> > > 
> > > This is not the place for support in writing your Lotus Notes code.
> > > 
> > > Since you are writing the data to a file, what we can help you with is the
> > > format of the file.  Are you making a .csv for import into OpenOffice Calc? 
> > > That would be the obvious thing.  
> > > 
> > > What is the nature of the file you are producing?
> > 
> > It looks from your code that you're trying to use automation to send the
> > data to Calc directly and having Calc make the file.  
> > 
> > How about making a file instead and importing that into Calc?  It will be
> > much easier to debug [;<).
> 
> 
> would you please explain how can I import to Calc? I'll give it a try.

I think I have misunderstood your use case.  See if Damjan's advice helps you.

-- 
You are receiving this mail because:
You are the assignee for the issue.

[Issue 126837] exporting date values from lotus notes to Calc doesn't work

Posted by bu...@apache.org.
https://bz.apache.org/ooo/show_bug.cgi?id=126837

damjan@apache.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |damjan@apache.org

--- Comment #1 from damjan@apache.org ---
Please explain how you are exporting them. Copy and paste? Save to a file
(which format)? Some API? Which code are you using?

-- 
You are receiving this mail because:
You are the assignee for the issue.

[Issue 126837] exporting date values from lotus notes to Calc doesn't work

Posted by bu...@apache.org.
https://bz.apache.org/ooo/show_bug.cgi?id=126837

--- Comment #2 from taniagar@in.ibm.com ---
(In reply to damjan from comment #1)
> Please explain how you are exporting them. Copy and paste? Save to a file
> (which format)? Some API? Which code are you using?

Hi, I'm saving data to a file using Lotus Notes application code. This is the
code Im using:

Sub Click(Source As Button)
       ''==''==''==''==''  Code For Creating Office Application
Automation Object              ''==''==''==''==''
       Dim SM As Variant
       Dim Desktop As Variant
       Dim args() As Variant
       Dim calApplication As Variant
       Dim worksheet As Variant
       Dim cell As Variant

       ''      Creating Handle To OpenOffice Object
       Set SM = CreateObject("com.sun.star.ServiceManager")

       ''      Create The Front-End Reference
       Set Desktop = SM.createInstance("com.sun.star.frame.Desktop")

       ''      Opening The Excel Application On Desktop Giving Focus
       Set calApplication =
Desktop.loadComponentFromURL("private:factory/scalc", "_blank" , 0 ,
args)

       ''      Setting Sheet Name
       Set worksheet = calApplication.Sheets.getByName("Sheet1")

       ''Set cell = worksheet.getCellByPosition(0,0)
       ''cell.setString("Testing Transport To OpenOffice")
       ''==''==''==''==''  Code For Creating Office Application
Automation A Object            ''==''==''==''==''

       Dim uiws As New NotesUIWorkspace
       Dim uiview As NotesUIView
       Dim view As NotesView
       Dim doc As NotesDocument
       Dim counter As Integer
       Dim xlr,xlc,loops As Integer
       Dim cell1,cell2,cell3 As Variant

       Set uiview  = uiws.CurrentView
       Set view = uiview.View

       loops = view.AllEntries.Count
       Set doc = view.GetFirstDocument

       Dim i As Integer
       i=0
       For i=0 To loops-1
              ''Exporting Notes-Data Code To OpenOffice Calc Applicaiton
               Set cell1 = worksheet.getCellByPosition(0,i)
               Set cell2 = worksheet.getCellByPosition(1,i)
               Set cell3 = worksheet.getCellByPosition(2,i)

               cell1.setString(Cstr(doc.EDForwardID(0)))
               cell2.setString(Cstr(doc.EDEmpMailID(0)))
               cell3.setString(Cstr(doc.EDEmpPh(0)))

               If(i<loops-1) Then
                       Set doc = view.GetNextDocument(doc)
               End If
       Next
       worksheet.Columns.Autofit
End Sub


what else can be used instead of setString function? I guess that is the one
preventing the dates to remain in the same format. My dates always get
converted to text.

-- 
You are receiving this mail because:
You are the assignee for the issue.

[Issue 126837] exporting date values from lotus notes to Calc doesn't work

Posted by bu...@apache.org.
https://bz.apache.org/ooo/show_bug.cgi?id=126837

--- Comment #5 from taniagar@in.ibm.com ---
(In reply to orcmid from comment #4)
> (In reply to orcmid from comment #3)
> > (In reply to taniagar from comment #2)
> > > (In reply to damjan from comment #1)
> > > > Please explain how you are exporting them. Copy and paste? Save to a file
> > > > (which format)? Some API? Which code are you using?
> > > 
> > > Hi, I'm saving data to a file using Lotus Notes application code. This is
> > > the code Im using:
> > > 
> > > Sub Click(Source As Button)
> > [ ... ]
> > 
> > This is not the place for support in writing your Lotus Notes code.
> > 
> > Since you are writing the data to a file, what we can help you with is the
> > format of the file.  Are you making a .csv for import into OpenOffice Calc? 
> > That would be the obvious thing.  
> > 
> > What is the nature of the file you are producing?
> 
> It looks from your code that you're trying to use automation to send the
> data to Calc directly and having Calc make the file.  
> 
> How about making a file instead and importing that into Calc?  It will be
> much easier to debug [;<).


would you please explain how can I import to Calc? I'll give it a try.

-- 
You are receiving this mail because:
You are the assignee for the issue.

[Issue 126837] exporting date values from lotus notes to Calc doesn't work

Posted by bu...@apache.org.
https://bz.apache.org/ooo/show_bug.cgi?id=126837

--- Comment #6 from damjan@apache.org ---
(In reply to taniagar from comment #2)
> (In reply to damjan from comment #1)
> > Please explain how you are exporting them. Copy and paste? Save to a file
> > (which format)? Some API? Which code are you using?
> 
> Hi, I'm saving data to a file using Lotus Notes application code. This is
> the code Im using:
> 
>        For i=0 To loops-1
>               ''Exporting Notes-Data Code To OpenOffice Calc Applicaiton
>                Set cell1 = worksheet.getCellByPosition(0,i)
>                Set cell2 = worksheet.getCellByPosition(1,i)
>                Set cell3 = worksheet.getCellByPosition(2,i)
> 
>                cell1.setString(Cstr(doc.EDForwardID(0)))
>                cell2.setString(Cstr(doc.EDEmpMailID(0)))
>                cell3.setString(Cstr(doc.EDEmpPh(0)))

Spreadsheets represent dates as numbers (the number of days since 00:00:00 on 2
January 1899), not as text, with formatting applied to show the number as a
date/time. Instead of those setString calls, try this:

' Set the date format:
LocalSettings.Language = "en"
LocalSettings.Country = "us"
NumberFormats = Doc.NumberFormats
NumberFormatString = "YYYY/MM/DD HH:MM:SS"
NumberFormatId = NumberFormats.queryKey(NumberFormatString, LocalSettings,
True)
If NumberFormatId = -1 Then
   NumberFormatId = NumberFormats.addNew(NumberFormatString, LocalSettings)
End If

' Populate the cells:
cell1.Value = doc.EDForwardID(0)
cell1.NumberFormat = NumberFormatId

-- 
You are receiving this mail because:
You are the assignee for the issue.

[Issue 126837] exporting date values from lotus notes to Calc doesn't work

Posted by bu...@apache.org.
https://bz.apache.org/ooo/show_bug.cgi?id=126837

taniagar@in.ibm.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P5 (lowest)                 |P2

-- 
You are receiving this mail because:
You are the assignee for the issue.

[Issue 126837] exporting date values from lotus notes to Calc doesn't work

Posted by bu...@apache.org.
https://bz.apache.org/ooo/show_bug.cgi?id=126837

mroe <mr...@gmx.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |NOT_AN_OOO_ISSUE
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #8 from mroe <mr...@gmx.net> ---
Maybe it's to late for the OP, but the answer should be:

You have to use .setValue() instead of .setString().

https://wiki.openoffice.org/wiki/Documentation/DevGuide/Spreadsheets/Access_to_Formulas,_Values_and_Errors

https://wiki.openoffice.org/wiki/Documentation/DevGuide/OfficeDev/Applying_Number_Formats

-- 
You are receiving this mail because:
You are the assignee for the issue.

[Issue 126837] exporting date values from lotus notes to Calc doesn't work

Posted by bu...@apache.org.
https://bz.apache.org/ooo/show_bug.cgi?id=126837

orcmid <or...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|orcmid@apache.org           |

-- 
You are receiving this mail because:
You are the assignee for the issue.