2 # -----------------------------------------------------------------------------
5 gi
.require_version('Gnm', '1.12')
6 gi
.require_version('GOffice', '0.10')
7 from gi
.repository
import Gnm
8 from gi
.repository
import GOffice
12 src_uri
= GOffice
.filename_to_uri (sys
.argv
[1])
13 dst_uri
= GOffice
.filename_to_uri (sys
.argv
[2])
15 # A context for reporting errors to stderr
16 cc
= Gnm
.CmdContextStderr
.new()
21 # A context for io operations
22 ioc
= GOffice
.IOContext
.new (cc
)
25 wbv
= Gnm
.WorkbookView
.new_from_uri (src_uri
, None, ioc
, None)
26 wb
= wbv
.props
.workbook
27 print("Loaded {}".format(wb
.props
.uri
))
30 fs
= GOffice
.FileSaver
.for_file_name (dst_uri
)
31 if wbv
.save_as (fs
, dst_uri
, cc
):
32 print("Saved {}".format(wb
.props
.uri
))
34 print("Failed to save to {}".format(dst_uri
))
37 # Remove our references to the objects