Commit ac35398b authored by Sergey.Konovalov's avatar Sergey.Konovalov Committed by Alexander.Trofimov

сохраняем в тот формат, который пришел на открытие.

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@52737 954022d7-b5bf-4e40-9824-e11837661b57
parent 8e40f05f
......@@ -67,6 +67,9 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
this.documentFormat = "null";
this.documentVKey = null;
this.documentOrigin = "";
this.documentFormatSave = c_oAscFileType.XLSX;
this.documentFormatSaveCsvCodepage = 65001;//utf8
this.documentFormatSaveCsvDelimiter = c_oAscCsvDelimiter.Comma;
this.cCharDelimiter = String.fromCharCode(5);
this.chartEditor = undefined;
this.documentOpenOptions = undefined; // Опции при открытии (пока только опции для CSV)
......@@ -429,6 +432,19 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
this.chartEditor = this.DocInfo["ChartEditor"];
this.documentOpenOptions = this.DocInfo["Options"];
if(this.documentFormat)
{
switch(this.documentFormat)
{
case "xlsx" : documentFormatSave = c_oAscFileType.XLSX;break;
case "xls" : documentFormatSave = c_oAscFileType.XLS;break;
case "ods" : documentFormatSave = c_oAscFileType.ODS;break;
case "csv" : documentFormatSave = c_oAscFileType.CSV;break;
case "htm" :
case "html" : documentFormatSave = c_oAscFileType.HTML;break;
}
}
var nIndex = -1;
if(this.documentTitle)
nIndex = this.documentTitle.lastIndexOf(".");
......@@ -723,6 +739,8 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
case c_oAscAdvancedOptionsID.CSV:
// Проверяем тип состояния в данный момент
if (this.advancedOptionsAction === c_oAscAdvancedOptionsAction.Open) {
this.documentFormatSaveCsvCodepage = option.asc_getCodePage();
this.documentFormatSaveCsvDelimiter = option.asc_getDelimiter();
var v = {"id":this.documentId, "format": this.documentFormat, "vkey": this.documentVKey, "editorid": c_oEditorId.Speadsheet, "c":"reopen", "url": this.documentUrl, "title": this.documentTitle, "embeddedfonts": this.isUseEmbeddedCutFonts, "delimiter": option.asc_getDelimiter(), "codepage": option.asc_getCodePage()};
this._asc_sendCommand(function (response) {t._startOpenDocument(response);}, v);
} else if (this.advancedOptionsAction === c_oAscAdvancedOptionsAction.Save)
......@@ -981,7 +999,12 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
oAdditionalData["c"] = "save";
oAdditionalData["id"] = this.documentId;
oAdditionalData["vkey"] = this.documentVKey;
oAdditionalData["outputformat"] = c_oAscFileType.INNER;
oAdditionalData["outputformat"] = this.documentFormatSave;
if(c_oAscFileType.CSV == this.documentFormatSave)
{
oAdditionalData["codepage"] = this.documentFormatSaveCsvCodepage;
oAdditionalData["delimiter"] = this.documentFormatSaveCsvDelimiter;
}
oAdditionalData["innersave"] = true;
oAdditionalData["savetype"] = "completeall";
oAdditionalData["data"] = data;
......
......@@ -9,6 +9,7 @@ var documentTitleWithoutExtention = 'null';
var documentFormat = 'null';
var documentVKey = null;
var documentOrigin = "";
var documentFormatSave = c_oAscFileType.PPTX;//пока не во что другое сохранять не можем.
var c_oSerFormat =
{
......@@ -1741,7 +1742,7 @@ asc_docs_api.prototype.onSaveCallback = function (e) {
oAdditionalData["c"] = "save";
oAdditionalData["id"] = documentId;
oAdditionalData["vkey"] = documentVKey;
oAdditionalData["outputformat"] = c_oAscFileType.INNER;
oAdditionalData["outputformat"] = documentFormatSave;
oAdditionalData["innersave"] = true;
oAdditionalData["savetype"] = "completeall";
oAdditionalData["data"] = data;
......
......@@ -10,6 +10,8 @@ var documentTitleWithoutExtention = 'null';
var documentFormat = 'null';
var documentVKey = null;
var documentOrigin = "";
var documentFormatSave = c_oAscFileType.DOCX;
var documentFormatSaveTxtCodepage = 65001;//utf8
function CDocOpenProgress()
{
......@@ -903,7 +905,24 @@ asc_docs_api.prototype.LoadDocument = function(c_DocInfo)
documentUrl = this.DocInfo.get_Url();
documentTitle = this.DocInfo.get_Title();
documentFormat = this.DocInfo.get_Format();
if(documentFormat)
{
switch(documentFormat)
{
case "docx" : documentFormatSave = c_oAscFileType.DOCX;break;
case "doc" : documentFormatSave = c_oAscFileType.DOC;break;
case "odt" : documentFormatSave = c_oAscFileType.ODT;break;
case "rtf" : documentFormatSave = c_oAscFileType.RTF;break;
case "txt" : documentFormatSave = c_oAscFileType.TXT;break;
case "htm" :
case "html" : documentFormatSave = c_oAscFileType.HTML_ZIP;break;
case "mht" : documentFormatSave = c_oAscFileType.MHT;break;
case "pdf" : documentFormatSave = c_oAscFileType.PDF;break;
case "epub" : documentFormatSave = c_oAscFileType.EPUB;break;
case "fb2" : documentFormatSave = c_oAscFileType.FB2;break;
case "mobi" : documentFormatSave = c_oAscFileType.MOBI;break;
}
}
var nIndex = -1;
if(documentTitle)
nIndex = documentTitle.lastIndexOf(".");
......@@ -2617,7 +2636,9 @@ function OnSave_Callback(e)
oAdditionalData["c"] = "save";
oAdditionalData["id"] = documentId;
oAdditionalData["vkey"] = documentVKey;
oAdditionalData["outputformat"] = c_oAscFileType.INNER;
oAdditionalData["outputformat"] = documentFormatSave;
if(c_oAscFileType.TXT == documentFormatSaveTxtCodepage)
oAdditionalData["codepage"] = documentFormatSaveTxtCodepage;
oAdditionalData["innersave"] = true;
var data = oBinaryFileWriter.Write();
oAdditionalData["savetype"] = "completeall";
......@@ -6930,7 +6951,8 @@ function sendCommand(editor, fCallback, rdata){
});
break;
case "needparams":
var rData = {"id":documentId, "format": documentFormat, "vkey": documentVKey, "editorid": c_oEditorId.Word, "c":"reopen", "url": documentUrl, "title": documentTitle, "codepage": 0, "embeddedfonts": editor.isUseEmbeddedCutFonts};
//todo dialog
var rData = {"id":documentId, "format": documentFormat, "vkey": documentVKey, "editorid": c_oEditorId.Word, "c":"reopen", "url": documentUrl, "title": documentTitle, "codepage": documentFormatSaveTxtCodepage, "embeddedfonts": editor.isUseEmbeddedCutFonts};
sendCommand(editor, fCallback, rData)
break;
case "waitopen":
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment