Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
sdkjs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
sdkjs
Commits
54fe8c7d
Commit
54fe8c7d
authored
May 04, 2017
by
Sergey Konovalov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
open/save csv with user defined delimiters
parent
6ef31345
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
4 deletions
+19
-4
cell/Local/api.js
cell/Local/api.js
+8
-1
cell/api.js
cell/api.js
+5
-2
common/AdvancedOptions.js
common/AdvancedOptions.js
+6
-1
No files found.
cell/Local/api.js
View file @
54fe8c7d
...
...
@@ -114,9 +114,16 @@ var c_oAscError = Asc.c_oAscError;
window
[
"
Asc
"
][
'
spreadsheet_api
'
].
prototype
.
asc_setAdvancedOptions
=
function
(
idOption
,
option
)
{
if
(
window
[
"
Asc
"
].
c_oAscAdvancedOptionsID
.
CSV
===
idOption
)
{
var
delimiter
=
option
.
asc_getDelimiter
();
var
delimiterChar
=
option
.
asc_getDelimiterChar
();
var
_param
=
""
;
_param
+=
(
"
<m_nCsvTxtEncoding>
"
+
option
.
asc_getCodePage
()
+
"
</m_nCsvTxtEncoding>
"
);
_param
+=
(
"
<m_nCsvDelimiter>
"
+
option
.
asc_getDelimiter
()
+
"
</m_nCsvDelimiter>
"
);
if
(
null
!=
delimiter
)
{
_param
+=
(
"
<m_nCsvDelimiter>
"
+
delimiter
+
"
</m_nCsvDelimiter>
"
);
}
if
(
null
!=
delimiterChar
)
{
_param
+=
(
"
<m_nCsvDelimiterChar>
"
+
delimiterChar
+
"
</m_nCsvDelimiterChar>
"
);
}
window
[
"
AscDesktopEditor
"
][
"
SetAdvancedOptions
"
](
_param
);
}
...
...
cell/api.js
View file @
54fe8c7d
...
...
@@ -603,6 +603,7 @@ var editor;
"
title
"
:
this
.
documentTitle
,
"
embeddedfonts
"
:
this
.
isUseEmbeddedCutFonts
,
"
delimiter
"
:
option
.
asc_getDelimiter
(),
"
delimiterChar
"
:
option
.
asc_getDelimiterChar
(),
"
codepage
"
:
option
.
asc_getCodePage
()};
sendCommand
(
this
,
null
,
v
);
...
...
@@ -646,8 +647,9 @@ var editor;
var
t
=
this
;
// Проверяем, возможно нам пришли опции для CSV
if
(
this
.
documentOpenOptions
&&
!
opt_isPassword
)
{
var
codePageCsv
=
AscCommon
.
c_oAscEncodingsMap
[
this
.
documentOpenOptions
[
"
codePage
"
]]
||
AscCommon
.
c_oAscCodePageUtf8
,
delimiterCsv
=
this
.
documentOpenOptions
[
"
delimiter
"
];
if
(
null
!=
codePageCsv
&&
null
!=
delimiterCsv
)
{
var
codePageCsv
=
AscCommon
.
c_oAscEncodingsMap
[
this
.
documentOpenOptions
[
"
codePage
"
]]
||
AscCommon
.
c_oAscCodePageUtf8
,
delimiterCsv
=
this
.
documentOpenOptions
[
"
delimiter
"
],
delimiterCharCsv
=
this
.
documentOpenOptions
[
"
delimiterChar
"
];
if
(
null
!=
codePageCsv
&&
(
null
!=
delimiterCsv
||
null
!=
delimiterCharCsv
))
{
this
.
asc_setAdvancedOptions
(
c_oAscAdvancedOptionsID
.
CSV
,
new
asc
.
asc_CCSVAdvancedOptions
(
codePageCsv
,
delimiterCsv
));
return
;
}
...
...
@@ -772,6 +774,7 @@ var editor;
if
(
options
.
CSVOptions
instanceof
asc
.
asc_CCSVAdvancedOptions
)
{
oAdditionalData
[
"
codepage
"
]
=
options
.
CSVOptions
.
asc_getCodePage
();
oAdditionalData
[
"
delimiter
"
]
=
options
.
CSVOptions
.
asc_getDelimiter
();
oAdditionalData
[
"
delimiterChar
"
]
=
options
.
CSVOptions
.
asc_getDelimiterChar
();
}
}
dataContainer
.
data
=
oBinaryFileWriter
.
Write
();
...
...
common/AdvancedOptions.js
View file @
54fe8c7d
...
...
@@ -94,12 +94,15 @@
asc_CTXTOptions
.
prototype
.
asc_getRecommendedSettings
=
function
()
{
return
this
.
recommendedSettings
;
};
/** @constructor */
function
asc_CCSVAdvancedOptions
(
codepage
,
delimite
r
){
function
asc_CCSVAdvancedOptions
(
codepage
,
delimiter
,
delimiterCha
r
){
this
.
codePage
=
codepage
;
this
.
delimiter
=
delimiter
;
this
.
delimiterChar
=
delimiterChar
;
}
asc_CCSVAdvancedOptions
.
prototype
.
asc_getDelimiter
=
function
(){
return
this
.
delimiter
;};
asc_CCSVAdvancedOptions
.
prototype
.
asc_setDelimiter
=
function
(
v
){
this
.
delimiter
=
v
;};
asc_CCSVAdvancedOptions
.
prototype
.
asc_getDelimiterChar
=
function
(){
return
this
.
delimiterChar
;};
asc_CCSVAdvancedOptions
.
prototype
.
asc_setDelimiterChar
=
function
(
v
){
this
.
delimiterChar
=
v
;};
asc_CCSVAdvancedOptions
.
prototype
.
asc_getCodePage
=
function
(){
return
this
.
codePage
;};
asc_CCSVAdvancedOptions
.
prototype
.
asc_setCodePage
=
function
(
v
){
this
.
codePage
=
v
;};
...
...
@@ -187,6 +190,8 @@
prot
=
asc_CCSVAdvancedOptions
.
prototype
;
prot
[
"
asc_getDelimiter
"
]
=
prot
.
asc_getDelimiter
;
prot
[
"
asc_setDelimiter
"
]
=
prot
.
asc_setDelimiter
;
prot
[
"
asc_getDelimiterChar
"
]
=
prot
.
asc_getDelimiterChar
;
prot
[
"
asc_setDelimiterChar
"
]
=
prot
.
asc_setDelimiterChar
;
prot
[
"
asc_getCodePage
"
]
=
prot
.
asc_getCodePage
;
prot
[
"
asc_setCodePage
"
]
=
prot
.
asc_setCodePage
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment