WO2018076815A1 - 格式转换方法及*** - Google Patents

格式转换方法及*** Download PDF

Info

Publication number
WO2018076815A1
WO2018076815A1 PCT/CN2017/093198 CN2017093198W WO2018076815A1 WO 2018076815 A1 WO2018076815 A1 WO 2018076815A1 CN 2017093198 W CN2017093198 W CN 2017093198W WO 2018076815 A1 WO2018076815 A1 WO 2018076815A1
Authority
WO
WIPO (PCT)
Prior art keywords
file
format
import
imported
data
Prior art date
Application number
PCT/CN2017/093198
Other languages
English (en)
French (fr)
Inventor
张坤明
Original Assignee
宁德时代新能源科技股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 宁德时代新能源科技股份有限公司 filed Critical 宁德时代新能源科技股份有限公司
Publication of WO2018076815A1 publication Critical patent/WO2018076815A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/178Techniques for file synchronisation in file systems
    • G06F16/1794Details of file format conversion

Definitions

  • the present application relates to the field of data processing, and in particular, to a format conversion method and system.
  • controller area network protocol In the process of software interaction, multiple protocols are used, for example, using a controller area network protocol.
  • the controller area network protocol is jointly developed by the user and the engineer, and the data content used by the two parties in the interaction process is based on the excel file.
  • the embodiment of the present application provides a format conversion method and system, which improves the reliability of the software in the process of software interaction.
  • the embodiment of the present application provides a format conversion method, including:
  • the parsed data is generated into a target file according to a preset target file generation method.
  • the method before the identifying the file format of the imported import file, the method further includes:
  • parsing the import file includes:
  • the import file is parsed according to the target file generation manner.
  • parsing the import file according to the target file generating manner includes:
  • the extracted data is adjusted according to the specified format to obtain the specified format data.
  • the parsed data is generated into an object file, including:
  • the source code file generation method another part of the specified format data is generated to generate a source code file.
  • the embodiment of the present application further provides a format conversion system, including:
  • An identification module for identifying a file format of the imported import file
  • a parsing module configured to parse the import file if the file format of the import file matches a preset file format
  • the generating module is configured to generate the target file by using the parsed data according to a preset target file generating manner.
  • system further includes:
  • a receiving module configured to receive the import file imported by a user.
  • the parsing module is specifically configured to:
  • the import file is parsed according to the target file generation manner.
  • the parsing module is specifically configured to:
  • the extracted data is adjusted according to the specified format to obtain the specified format data.
  • the generating module is specifically configured to:
  • the source code file generation method another part of the specified format data is generated to generate a source code file.
  • the format conversion method and system provided by the embodiment of the present application, by identifying the file format of the import file imported by the user, to determine whether the file format of the imported file matches the preset file format, and if the file format of the imported file is When the file format is matched, the import file is parsed, and then the parsed data is generated according to a preset target file generation manner. Therefore, in the technical solution of the present application, in the file format conversion process, The format conversion system can automatically convert the file imported by the user into the target file, and the user does not need to operate, which reduces the operation cost, improves the accuracy of the file format conversion, improves the reliability of the software in the process of software interaction, and solves the present problem. In the technology, the user and the user interact with each other in the process of using the software, and the user is prone to writing errors, resulting in poor reliability of the software.
  • FIG. 1 is a flowchart of Embodiment 1 of a format conversion method according to an embodiment of the present application
  • FIG. 2 is a flowchart of Embodiment 2 of a format conversion method according to an embodiment of the present disclosure
  • FIG. 3 is a flowchart of Embodiment 3 of a format conversion method according to an embodiment of the present disclosure
  • FIG. 4 is a schematic structural diagram of Embodiment 1 of a format conversion system according to an embodiment of the present disclosure
  • FIG. 5 is a schematic structural diagram of Embodiment 2 of a format conversion system according to an embodiment of the present disclosure.
  • FIG. 1 is a flowchart of Embodiment 1 of a format conversion method according to an embodiment of the present disclosure. As shown in FIG. 1 , the format conversion method in this embodiment may include the following steps:
  • the user When using the computer, the user saves files in various file formats, such as excel files, word files, PPT files, etc. Therefore, in the format conversion process, it is preferred to set the file format of the file, which is implemented in the present application.
  • the file format is excel, for example, in the actual application, other file formats can also be set.
  • the format conversion method is applied to the format conversion system, and the language used in writing the format conversion system is the high-level programming language C#. In practical applications, it is not limited to using advanced programming. In the language C#, you can also use other languages to write a format conversion system.
  • the file format conversion is performed on the file format excel. Therefore, it is preferred to identify whether the file format of the import file imported by the user is the excel format.
  • the format conversion system After the user imports the file, the format conversion system automatically recognizes the imported file. When the imported file format matches the preset file format, it can be determined that the format conversion system can start parsing the imported file when importing. If the file format does not match the default file format, the format conversion system may prompt the user to import the file with the wrong file format. Please check the file.
  • the cross-platform class library in the process of parsing the import file, can be used to parse the import file, for example, using an ExcelDataReader (data processing class library) to parse the import file.
  • ExcelDataReader data processing class library
  • the target file generation mode may be preset, and the target file generation mode may be set according to the needs of the user, so as to achieve the purpose of facilitating interaction between the users. For example, using the multithreading technology of the high-level programming language C#, create at least one task, each task is one The target file generation method, and each target file generation method can be used by different users.
  • the data generated by parsing the imported excel file is generated according to a preset target generation manner, and the target file may be directly sent to the computer where the user is located, or may be stored in the computer where the format conversion system is located.
  • the target file may be directly sent to the computer where the user is located, or may be stored in the computer where the format conversion system is located. In read-only memory.
  • the format conversion system may be a single system software, or may be integrated into other software.
  • the format conversion method provided by the embodiment of the present application analyzes the import file imported by the user by using the format conversion system, and then generates the target file according to the target file generation manner preset in the format conversion system. Therefore, in the present application, In the technical solution, in the conversion process of the file format, the format conversion system can automatically convert the file imported by the user into the target file, the user does not need to perform operations, the operation cost is reduced, the accuracy of the file format conversion is improved, and the software interaction is performed. In the process, the reliability of the software is improved, and the problem that the user and the user interact with the software in the prior art, the user is prone to writing errors, and the reliability of the software is poor.
  • FIG. 2 is a flowchart of a second embodiment of a format conversion method according to an embodiment of the present disclosure. As shown in FIG. 2, the format conversion method in this embodiment may include the following steps:
  • a user When a user needs to format a file, he first needs to import the file into the format conversion system. For example, import the file into the format conversion system at the specified port, and then the format conversion system receives the user by using the specified port. Imported import file.
  • step 203 Determine whether the file format of the imported file matches the preset file format. If yes, go to step 204. If not, go to step 205.
  • the file format of the imported file matches the preset file format, it is determined whether the content of the imported file is complete. If the content of the imported file is complete, the import file is parsed according to the target file generation manner. .
  • the content integrity of the imported file needs to be judged, and when the content of the imported file is incomplete, the prompt may be prompted.
  • the user import file is incorrect, the user needs to re-import, or the format conversion system will stop running. If the content of the imported file is complete, the import file is parsed according to the target file generation method.
  • the default file format is an EXCEL file
  • the file has a table with the message name, message length, message sender, and message receiver four list headers, and the contents of the imported file are complete.
  • the user imports a table with the file format EXCEL. As shown in Table 1, the table has the message name, message length, message sender, and message receiver four list headers, and can detect the file format imported by the user and the preset. The file format is matched and the content is complete. Then, the import file is parsed according to the target file generation mode.
  • the default file format is an EXCEL file. If a user imports a file with a file format of WORD, the user is prompted to import the imported file in the wrong format.
  • the format conversion method provided by the embodiment of the present application firstly receives the import file imported by the user by using the format conversion system, and confirms whether the format of the imported file matches the preset format, and parses the import file imported by the user after determining the format matching. And then generating the target file according to the target file generation manner preset in the format conversion system. Therefore, in the technical solution of the present application, the format conversion system can automatically import the file imported by the user in the file format conversion process. Converting to the target file, the user does not need to operate, reduces the operation cost, improves the accuracy of the file format conversion, improves the reliability of the software in the process of software interaction, and solves the problem that the user and the user in the prior art use the software. During the interaction process, the user is prone to writing errors, resulting in poor software reliability.
  • FIG. 3 is a flowchart of a third embodiment of a format conversion method according to an embodiment of the present disclosure. As shown in FIG. 3, the format conversion method in this embodiment may include the following steps:
  • the user may store the file in the read-only memory. If the user needs to perform format conversion on multiple import files, the user can store multiple import files in the read-only memory after importing all the imported files. When the user needs to format the multiple imported files, the format is The conversion system can retrieve the format file from the read-only memory.
  • step 304 Determine whether the file format of the imported import file matches the preset file format. If yes, go to step 305. If not, go to step 306.
  • the method may include:
  • the extracted data is adjusted according to the specified format to obtain the specified format data.
  • the EXCEL file is taken as an example in a preset file format, and the specified location may be a header of each column in the table of the EXCEL file, as shown in Table 2.
  • the table has a message name, a message length, a message sender, and a message receiver four list header, there are four specified positions in the table, namely, a message name, a message length, a message sender, and a message receiver. Then, the data of each column of the specified position in each row of data is sequentially extracted, for example, the first row data is extracted as 1, 16, 001, 002.
  • the specified format is: message name_message length_message sender_message receiver, and then each row of data extracted in the table is sequentially adjusted to the specified format data, for example, the first format specified format data is 1_16_001_002 .
  • the source code file generation method another part of the specified format data is generated into a source code file.
  • the preset target file production manner includes two types, one is a database file generation manner, and the other is a source code file generation manner, and each target file generation format corresponds to one target file.
  • the object file corresponding to the database file generation mode is the file name suffix of the .DBC object file, and the source code file generation mode corresponds to the file name with the suffix of .c or .h.
  • the specified format data generated after parsing in step 305 is edited to generate a corresponding target file.
  • a regular expression is used to edit a part of the specified format data generated after parsing, and the file name is XXX.c object file.
  • the format conversion method provided by the embodiment of the present application firstly receives the import file imported by the user by using the format conversion system, and confirms whether the format of the imported file matches the preset format, and parses the import file imported by the user after determining the format matching. And then generating the target file according to the target file generation manner preset in the format conversion system. Therefore, in the technical solution of the present application, the format conversion system can automatically import the file imported by the user in the file format conversion process. Converting to the target file, the user does not need to operate, reduces the operation cost, improves the accuracy of the file format conversion, improves the reliability of the software in the process of software interaction, and solves the problem that the user and the user in the prior art use the software. During the interaction process, the user is prone to writing errors, resulting in poor software reliability.
  • FIG. 4 is a schematic structural diagram of Embodiment 1 of a format conversion system according to an embodiment of the present disclosure.
  • the format conversion system of this embodiment may include: an identification module 11, a parsing module 12, and a generating module.
  • the identification module 11 is configured to identify a file format of the imported import file.
  • the parsing module 12 is configured to parse the imported file if the file format of the imported file identified by the identification module 11 matches the preset file format.
  • the generating module 13 is configured to generate an object file by parsing the parsed data of the parsing module 12 according to a preset target file generating manner.
  • the system of the present embodiment can be used to implement the technical solution of the method embodiment shown in FIG. 1 , and the implementation principle and technical effects are similar, and details are not described herein again.
  • FIG. 5 is a schematic structural diagram of Embodiment 2 of a format conversion system according to an embodiment of the present disclosure. As shown in FIG. 5, the format conversion system of this embodiment may further include: a receiving module 14 on the basis of Embodiment 4.
  • the receiving module 14 is configured to receive an import file imported by the user.
  • the parsing module 12 is specifically configured to:
  • the import file is parsed according to the target file generation method.
  • the system of the present embodiment can be used to implement the technical solution of the method embodiment shown in FIG. 2, and the implementation principle and technical effects are similar, and details are not described herein again.
  • the format conversion system of this embodiment is based on the fifth embodiment, and the parsing module 12 is specifically configured to:
  • the extracted data is adjusted according to the specified format to obtain the specified format data.
  • the generating module 13 is specifically configured to:
  • the source code file generation method another part of the specified format data is generated into a source code file.
  • the system of the present embodiment can be used to implement the technical solution of the method embodiment shown in FIG. 3, and the implementation principle and technical effects are similar, and details are not described herein again.
  • the aforementioned program can be stored in a computer readable storage medium.
  • the program when executed, performs the steps including the foregoing method embodiments; and the foregoing storage medium includes various media that can store program codes, such as a ROM, a RAM, a magnetic disk, or an optical disk.
  • the device embodiments described above are merely illustrative, wherein the units illustrated as separate components may or may not be physically separate, and the components displayed as units may or may not be physical units, ie may be located in one place. Or it can be distributed to at least two network elements. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the embodiment. Those of ordinary skill in the art can understand and implement without deliberate labor.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

一种格式转换方法及***,该格式转换方法包括:识别导入的导入文件的文件格式(101);若导入文件的文件格式与预设的文件格式相匹配,对导入文件进行解析(102);根据预设的目标文件生成方式,将解析后的数据生成目标文件(103)。在文件格式的转换过程中,格式转换***可以自动将用户导入的文件转换成目标文件,用户无需进行操作,降低了操作成本,提高了文件格式转换的准确性,在软件交互的过程中,提高软件的可靠性和交互性。

Description

格式转换方法及*** 技术领域
本申请涉及数据处理领域,尤其涉及一种格式转换方法及***。
背景技术
随着现代社会的发展,使得计算机技术以及相应的软件产品一直处于增长的状态。各行各业在生产过程中均需要使用软件产品,面对庞大的软件产品需求,如何提高软件的生产效率,降低成本,成为各行各业所需要解决的问题。
在软件的交互过程中,会使用多种协议,例如,使用控制器局域网络协议。现有技术中,控制器局域网络协议是用户与工程师共同开发的,双方在交互过程中使用的数据内容基于excel文件。
用户与用户在使用软件进行交互的过程中,通常使用手动编写代码来完成,由于用户与用户之间会有不同的语言习惯,并且在编写代码的过程中容易出现编写错误,从而导致软件的可靠性较差的问题。
申请内容
本申请实施例提供一种格式转换方法及***,实现了在软件交互的过程中,提高软件的可靠性。
本申请实施例提供一种格式转换方法,包括:
识别导入的导入文件的文件格式;
若所述导入文件的文件格式与预设的文件格式相匹配,对所述导入文件进行解析;
根据预设的目标文件生成方式,将解析后的数据生成目标文件。
进一步地,上述方法中,所述识别导入的导入文件的文件格式之前,所述方法还包括:
接收用户导入的所述导入文件。
进一步地,上述方法中,所述若所述导入文件的文件格式与预设的文件格式相匹配,对所述导入文件进行解析,包括:
若所述导入文件的文件格式与预设的文件格式相匹配,确定所述导入文件的内容是否完整;
若所述导入文件的内容完整,对所述导入文件按照所述目标文件生成方式进行解析。
进一步地,上述方法中,所述若所述导入文件的内容完整,对所述导入文件按照所述目标文件生成方式进行解析,包括:
对所述导入文件中的指定位置的数据进行提取;
将提取到的数据按照指定格式进行调整,得到指定格式数据。
进一步地,上述方法中,根据预设的目标文件生成方式,将解析后的数据生成目标文件,包括:
根据数据库文件生成方式,将一部分所述指定格式数据生成数据库文件;以及,
根据源代码文件生成方式,将另一部分所述指定格式数据生成源代码文件。
本申请实施例还提供一种格式转换***,包括:
识别模块,用于识别导入的导入文件的文件格式;
解析模块,用于若所述导入文件的文件格式与预设的文件格式相匹配,对所述导入文件进行解析;
生成模块,用于根据预设的目标文件生成方式,将解析后的数据生成目标文件。
进一步地,上述***中,所述***还包括:
接收模块,用于接收用户导入的所述导入文件。
进一步地,上述***中,所述解析模块,具体用于:
若所述导入文件的文件格式与预设的文件格式相匹配,确定所述导入文件的内容是否完整;
若所述导入文件的内容完整,对所述导入文件按照所述目标文件生成方式进行解析。
进一步地,上述***中,所述解析模块,具体用于:
对所述导入文件中的指定位置的数据进行提取;
将提取到的数据按照指定格式进行调整,得到指定格式数据。
进一步地,上述***中,所述生成模块,具体用于:
根据数据库文件生成方式,将一部分所述指定格式数据生成数据库文件;以及,
根据源代码文件生成方式,将另一部分所述指定格式数据生成源代码文件。
本申请实施例提供的格式转换方法及***,通过对用户导入的导入文件的文件格式进行识别,以判断导入文件的文件格式与预设的文件格式是否相匹配,若导入文件的文件格式与预设的文件格式相匹配时,对导入文件进行解析,然后根据预设的目标文件生成方式,将解析后的数据生成目标文件,因此,在本申请技术方案中,在文件格式的转换过程中,格式转换***可以自动将用户导入的文件转换成目标文件,用户无需进行操作,降低了操作成本,提高了文件格式转换的准确性,在软件交互的过程中,提高软件的可靠性,解决了现有技术中用户与用户在使用软件进行交互过程中,用户容易出现编写错误,导致软件的可靠性较差的问题。
附图说明
为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作一简单地介绍,显而易见地,下面描述中的附图是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。
图1为本申请实施例提供的格式转换方法实施例一的流程图;
图2为本申请实施例提供的格式转换方法实施例二的流程图;
图3为本申请实施例提供的格式转换方法实施例三的流程图;
图4为本申请实施例提供的格式转换***实施例一的结构示意图;
图5为本申请实施例提供的格式转换***实施例二的结构示意图。
具体实施方式
为使本申请实施例的目的、技术方案和优点更加清楚,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。基于 本申请中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。
实施例一
图1为本申请实施例提供的格式转换方法实施例一的流程图,如图1所示,本实施例的格式转换方法,具体可以包括如下步骤:
101、识别导入的导入文件的文件格式。
用户在使用计算机的时候会保存多种文件格式的文件,例如,excel文件、word文件、PPT文件等,因此,在格式转换过程中,首选要对文件的文件格式进行设定,在本申请实施例中,以文件格式为excel的文件进行举例说明,在实际应用中,还可以设定其他的文件格式。
需要说明的是,在本申请实施例中,格式转换方法应用于格式转换***中,且编写格式转换***时所使用的语言为高级编程语言C#,在实际应用中,并不限制于使用高级编程语言C#这一种语言,还可以使用其他语言来编写格式转换***。
在本申请实施例中,预先在格式转换***中,设定对文件格式为excel的文件进行格式转换,因此,首选需要识别用户导入的导入文件的文件格式是否为excel格式。
102、若导入文件的文件格式与预设的文件格式相匹配,对导入文件进行解析。
当用户导入文件后,格式转换***自动对导入的文件进行识别,当导入的文件格式与预设的文件格式相匹配时,即可以认定为格式转换***可以开始对导入的文件进行解析,当导入的文件格式与预设的文件格式不匹配时,则格式转换***可以提示用户导入文件的文件格式有误,请用户进行核对。
在本申请实施例中,在对导入文件进行解析的过程中,可以利用支持跨平台类库来对导入文件进行解析,例如使用ExcelDataReader(数据处理类库)来对导入文件进行解析。
103、根据预设的目标文件生成方式,将解析后的数据生成目标文件。
在本申请实施例中,可以预先设定目标文件生成方式,目标文件生成方式可以根据用户的需要进行设定,以实现有利于用户进行交互的目的。例如,利用高级编程语言C#的多线程技术,创建至少一个任务,每个任务即为一个 目标文件生成方式,且每个目标文件生成方式均可以用于不同的用户使用。
然后,将对导入的excel文件解析后生成的数据,依照预设的目标生成方式来生成相应的目标文件,该目标文件可以直接发送至用户所在的计算机,也可以存储在格式转换***所在的计算机的只读存储器中。
需要说明的是,在本申请实施例中,格式转换***可以是单独的一个***软件,也可以集成在其他软件中。
本申请实施例提供的格式转换方法,利用格式转换***将用户导入的导入文件进行解析,然后根据格式转换***中预设的目标文件生成方式将解析后的数据生成目标文件,因此,在本申请技术方案中,在文件格式的转换过程中,格式转换***可以自动将用户导入的文件转换成目标文件,用户无需进行操作,降低了操作成本,提高了文件格式转换的准确性,在软件交互的过程中,提高软件的可靠性,解决了现有技术中用户与用户在使用软件进行交互过程中,用户容易出现编写错误,导致软件的可靠性较差的问题。
实施例二
图2为本申请实施例提供的格式转换方法实施例二的流程图,如图2所示,本实施例的格式转换方法,具体可以包括如下步骤:
201、接收用户导入的导入文件。
用户在需要将某个文件进行格式转换时,首先需要将该文件导入至格式转换***中,例如,在指定的端口处将文件导入至格式转换***中,然后格式转换***利用指定的端口接收用户导入的导入文件。
202、识别导入的导入文件的文件格式。
203、判断导入文件的文件格式与预设的文件格式是否匹配,若匹配,执行步骤204,若不匹配,执行步骤205。
204、对导入文件进行解析,执行步骤206。
具体地,在本申请实施例中,若导入文件的文件格式与预设的文件格式相匹配,确定导入文件的内容是否完整,若导入文件的内容完整,对导入文件按照目标文件生成方式进行解析。
可以理解的是,为了保障格式转换结果与用户预期的转换结果相同,需要对导入文件的内容完整性进行判断,当导入文件的内容不完整,可以提示 用户导入文件有误,需用户重新导入,或者格式转换***将停止运行。若导入文件的内容完整,对导入文件按照目标文件生成方式进行解析。
例如,预设的文件格式为EXCEL文件,文件中具备一个表格,表格中具备消息名称、消息长度、消息发送方、消息接收方四列表头时,导入文件的内容完整。用户导入一个文件格式为EXCEL的表格,如表1所示,表格中具备消息名称、消息长度、消息发送方、消息接收方四列表头,则可以检测出,用户导入的文件格式与预设的文件格式匹配且内容完整,然后,对导入文件按照目标文件生成方式进行解析。
消息名称 消息长度 消息发送方 消息接收方
…… …… …… ……
…… …… …… ……
…… …… …… ……
表1
205、提示用户导入的导入文件格式错误。
例如,预设的文件格式为EXCEL文件,用户导入一个文件格式为WORD的文件,则提示用户导入的导入文件格式错误。
206、根据预设的目标文件生成方式,将解析后的数据生成目标文件。
本申请实施例提供的格式转换方法,利用格式转换***首先接收用户导入的导入文件,并确认导入文件的格式与预设的格式是否匹配,并在确定格式匹配后将用户导入的导入文件进行解析,然后根据格式转换***中预设的目标文件生成方式将解析后的数据生成目标文件,因此,在本申请技术方案中,在文件格式的转换过程中,格式转换***可以自动将用户导入的文件转换成目标文件,用户无需进行操作,降低了操作成本,提高了文件格式转换的准确性,在软件交互的过程中,提高软件的可靠性,解决了现有技术中用户与用户在使用软件进行交互过程中,用户容易出现编写错误,导致软件的可靠性较差的问题。
实施例三
图3为本申请实施例提供的格式转换方法实施例三的流程图,如图3所示,本实施例的格式转换方法,具体可以包括如下步骤:
301、接收用户导入的导入文件。
302、识别导入的导入文件的文件格式。
303、将导入文件存储在只读存储器中。
在本申请实施例中,用户在导入了导入文件后,若用户不需要立即对该导入文件进行格式的转换,可以存储在只读存储器中。若用户需要对多个导入文件进行格式转换,用户在导入了所有的导入文件后,也可以将多个导入文件存储在只读存储器中,待用户需要对多个导入文件进行格式转换时,格式转换***可以从只读存储器中调取格式文件。
304、判断导入的导入文件的文件格式与预设的文件格式是否匹配,若匹配,执行步骤305,若不匹配,执行步骤306。
305、对导入文件进行解析,执行步骤307。
在本申请实施例中,在上述实施例二中步骤204的基础上,可以包括:
对导入文件中的指定位置的数据进行提取;
将提取到的数据按照指定格式进行调整,得到指定格式数据。
具体地,在本申请实施例中,以预设的文件格式为EXCEL文件为例进行说明,指定位置可以是EXCEL文件的表格中每一列的表头,如表2所示,
消息名称 消息长度 消息发送方 消息接收方
1 16 001 002
2 32 002 003
3 48 003 004
表2
例如,表格中具备消息名称、消息长度、消息发送方、消息接收方四列表头,则该表格中指定位置有四个,分别为消息名称、消息长度、消息发送方、消息接收方。然后依次提取每行数据中,每一个指定位置所在列的数据,例如,提取第一行数据为1、16、001、002。
然后,设定指定格式为:消息名称_消息长度_消息发送方_消息接收方,则依次将表格中提取到的每行数据调整为该指定格式数据,例如,第一行指定格式数据为1_16_001_002。
需要说明的是,在本申请实施例中,指定位置可以有多个,其根据具体的目标文件生成方式进行设定,相应的指定格式也可以由多个,在本申请实 施例中,仅列举其中一种目标文件生成方式进行说明,在实际应用中,并不限制于该种目标文件生成方式。
306、提示用户导入的导入文件格式错误。
307、根据预设的目标文件生成方式,将解析后的数据生成目标文件。
根据数据库文件生成方式,将一部分指定格式数据生成数据库文件;以及,
根据源代码文件生成方式,将另一部分指定格式数据生成源代码文件。
具体地,在本申请实施例中,预设的目标文件生产方式包括两种,一种为数据库文件生成方式,另一种为源代码文件生成方式,每种目标文件生成格式对应一种目标文件。其中,数据库文件生成方式所对应的目标文件为文件名的后缀为.DBC的目标文件,源代码文件生成方式所对应的为文件名的后缀为.c或.h的目标文件。
根据预设的目标文件生成方式,将步骤305中,解析后所生成指定格式数据进行编辑,生成相应的目标文件。例如,使用正则表达式对解析后所生成一部分指定格式数据进行编辑,生成文件名为XXX.c目标文件。
本申请实施例提供的格式转换方法,利用格式转换***首先接收用户导入的导入文件,并确认导入文件的格式与预设的格式是否匹配,并在确定格式匹配后将用户导入的导入文件进行解析,然后根据格式转换***中预设的目标文件生成方式将解析后的数据生成目标文件,因此,在本申请技术方案中,在文件格式的转换过程中,格式转换***可以自动将用户导入的文件转换成目标文件,用户无需进行操作,降低了操作成本,提高了文件格式转换的准确性,在软件交互的过程中,提高软件的可靠性,解决了现有技术中用户与用户在使用软件进行交互过程中,用户容易出现编写错误,导致软件的可靠性较差的问题。
实施例四
图4为本申请实施例提供的格式转换***实施例一的结构示意图,如图4所示,本实施例的格式转换***可以包括:识别模块11、解析模块12和生成模块。
识别模块11,用于识别导入的导入文件的文件格式。
解析模块12,用于若识别模块11识别的导入文件的文件格式与预设的文件格式相匹配,对导入文件进行解析。
生成模块13,用于根据预设的目标文件生成方式,将解析模块12解析后的数据生成目标文件。
本实施例的***,可以用于执行图1所示方法实施例的技术方案,其实现原理和技术效果类似,此处不再赘述。
实施例五
图5为本申请实施例提供的格式转换***实施例二的结构示意图,如图5所示,本实施例的格式转换***在实施例四的基础上,还可以包括:接收模块14。
接收模块14,用于接收用户导入的导入文件。
具体地,解析模块12,具体用于:
若导入文件的文件格式与预设的文件格式相匹配,确定导入文件的内容是否完整;
若导入文件的内容完整,对导入文件按照目标文件生成方式进行解析。
本实施例的***,可以用于执行图2所示方法实施例的技术方案,其实现原理和技术效果类似,此处不再赘述。
实施例五
本实施例的格式转换***在实施例五的基础上,解析模块12,具体用于:
对导入文件中的指定位置的数据进行提取;
将提取到的数据按照指定格式进行调整,得到指定格式数据。
生成模块13,具体用于:
根据数据库文件生成方式,将一部分指定格式数据生成数据库文件;以及,
根据源代码文件生成方式,将另一部分指定格式数据生成源代码文件。
本实施例的***,可以用于执行图3所示方法实施例的技术方案,其实现原理和技术效果类似,此处不再赘述。
本领域普通技术人员可以理解:实现上述各方法实施例的全部或部分步骤可以通过程序指令相关的硬件来完成。前述的程序可以存储于一计算机可读取存储介质中。该程序在执行时,执行包括上述各方法实施例的步骤;而前述的存储介质包括:ROM、RAM、磁碟或者光盘等各种可以存储程序代码的介质。
以上所描述的装置实施例仅仅是示意性的,其中作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到至少两个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。本领域普通技术人员在不付出创造性的劳动的情况下,即可以理解并实施。
最后应说明的是:以上各实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述各实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分或者全部技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的范围。

Claims (10)

  1. 一种格式转换方法,其特征在于,包括:
    识别导入的导入文件的文件格式;
    若所述导入文件的文件格式与预设的文件格式相匹配,对所述导入文件进行解析;
    根据预设的目标文件生成方式,将解析后的数据生成目标文件。
  2. 根据权利要求1所述的方法,其特征在于,所述识别导入的导入文件的文件格式之前,所述方法还包括:
    接收用户导入的所述导入文件。
  3. 根据权利要求1所述的方法,其特征在于,所述若所述导入文件的文件格式与预设的文件格式相匹配,对所述导入文件进行解析,包括:
    若所述导入文件的文件格式与预设的文件格式相匹配,确定所述导入文件的内容是否完整;
    若所述导入文件的内容完整,对所述导入文件按照所述目标文件生成方式进行解析。
  4. 根据权利要求3所述的方法,其特征在于,所述若所述导入文件的内容完整,对所述导入文件按照所述目标文件生成方式进行解析,包括:
    对所述导入文件中的指定位置的数据进行提取;
    将提取到的数据按照指定格式进行调整,得到指定格式数据。
  5. 根据权利要求4所述的方法,其特征在于,根据预设的目标文件生成方式,将解析后的数据生成目标文件,包括:
    根据数据库文件生成方式,将一部分所述指定格式数据生成数据库文件;以及,
    根据源代码文件生成方式,将另一部分所述指定格式数据生成源代码文件。
  6. 一种格式转换***,其特征在于,包括:
    识别模块,用于识别导入的导入文件的文件格式;
    解析模块,用于若所述导入文件的文件格式与预设的文件格式相匹配,对所述导入文件进行解析;
    生成模块,用于根据预设的目标文件生成方式,将解析后的数据生成目 标文件。
  7. 根据权利要求6所述的***,其特征在于,所述***还包括:
    接收模块,用于接收用户导入的所述导入文件。
  8. 根据权利要求6所述的***,其特征在于,所述解析模块,具体用于:
    若所述导入文件的文件格式与预设的文件格式相匹配,确定所述导入文件的内容是否完整;
    若所述导入文件的内容完整,对所述导入文件按照所述目标文件生成方式进行解析。
  9. 根据权利要求8所述的***,其特征在于,所述解析模块,具体用于:
    对所述导入文件中的指定位置的数据进行提取;
    将提取到的数据按照指定格式进行调整,得到指定格式数据。
  10. 根据权利要求9所述的***,其特征在于,所述生成模块,具体用于:
    根据数据库文件生成方式,将一部分所述指定格式数据生成数据库文件;以及,
    根据源代码文件生成方式,将另一部分所述指定格式数据生成源代码文件。
PCT/CN2017/093198 2016-10-28 2017-07-17 格式转换方法及*** WO2018076815A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201610966320.1 2016-10-28
CN201610966320.1A CN106528744A (zh) 2016-10-28 2016-10-28 格式转换方法及***

Publications (1)

Publication Number Publication Date
WO2018076815A1 true WO2018076815A1 (zh) 2018-05-03

Family

ID=58325904

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/093198 WO2018076815A1 (zh) 2016-10-28 2017-07-17 格式转换方法及***

Country Status (2)

Country Link
CN (1) CN106528744A (zh)
WO (1) WO2018076815A1 (zh)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109325217A (zh) * 2018-09-19 2019-02-12 深圳市元征科技股份有限公司 一种文件转换方法、***、装置及计算机可读存储介质
CN113965776A (zh) * 2021-10-20 2022-01-21 江下信息科技(惠州)有限公司 一种多模式的音视频格式高速转换方法及***
CN114840597A (zh) * 2022-07-04 2022-08-02 杭州安恒信息技术股份有限公司 一种组件参数格式转换方法、装置、设备及存储介质
CN115542882A (zh) * 2022-09-30 2022-12-30 东风汽车股份有限公司 一种控制器接口配置方法及装置

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106528744A (zh) * 2016-10-28 2017-03-22 宁德时代新能源科技股份有限公司 格式转换方法及***
CN107247697A (zh) * 2017-07-05 2017-10-13 上海蔚赫信息科技有限公司 一种Excel文件转换为汽车网络DBC文件的方法
CN110874522B (zh) * 2018-09-03 2024-04-30 珠海金山办公软件有限公司 文件格式转换方法、装置、电子设备及存储介质
CN110347641B (zh) * 2019-06-26 2022-04-26 北京明略软件***有限公司 文件处理方法及装置、存储介质、电子装置
CN110533776A (zh) * 2019-08-31 2019-12-03 王亚亚 一种高精度倾斜摄影建模方法
CN111552665B (zh) * 2020-04-27 2023-08-01 光际科技(上海)有限公司 标注信息格式转换方法、装置、设备和介质
CN113190504A (zh) * 2021-05-27 2021-07-30 北京一雄信息科技有限公司 文件格式转换方法及***
CN113660156B (zh) * 2021-08-09 2022-10-21 覃飞 一种传输文件的处理方法、装置、电子设备及存储介质
CN116594960B (zh) * 2023-06-08 2024-01-30 镁佳(北京)科技有限公司 描述性文件格式转换方法、装置、计算机设备及存储介质

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6484178B1 (en) * 1999-12-30 2002-11-19 The Merallis Company Universal claims formatter
CN103491135A (zh) * 2013-09-02 2014-01-01 用友软件股份有限公司 自匹配数据格式的装置和方法
CN104217396A (zh) * 2014-09-11 2014-12-17 广西桂能软件有限公司 Dwg文件格式转换方法
CN105245943A (zh) * 2015-09-28 2016-01-13 北京奇艺世纪科技有限公司 一种为本地视频文件匹配字幕文件的方法和装置
CN106528744A (zh) * 2016-10-28 2017-03-22 宁德时代新能源科技股份有限公司 格式转换方法及***

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6484178B1 (en) * 1999-12-30 2002-11-19 The Merallis Company Universal claims formatter
CN103491135A (zh) * 2013-09-02 2014-01-01 用友软件股份有限公司 自匹配数据格式的装置和方法
CN104217396A (zh) * 2014-09-11 2014-12-17 广西桂能软件有限公司 Dwg文件格式转换方法
CN105245943A (zh) * 2015-09-28 2016-01-13 北京奇艺世纪科技有限公司 一种为本地视频文件匹配字幕文件的方法和装置
CN106528744A (zh) * 2016-10-28 2017-03-22 宁德时代新能源科技股份有限公司 格式转换方法及***

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109325217A (zh) * 2018-09-19 2019-02-12 深圳市元征科技股份有限公司 一种文件转换方法、***、装置及计算机可读存储介质
CN109325217B (zh) * 2018-09-19 2023-04-18 深圳市元征科技股份有限公司 一种文件转换方法、***、装置及计算机可读存储介质
CN113965776A (zh) * 2021-10-20 2022-01-21 江下信息科技(惠州)有限公司 一种多模式的音视频格式高速转换方法及***
CN113965776B (zh) * 2021-10-20 2022-07-05 江下信息科技(惠州)有限公司 一种多模式的音视频格式高速转换方法及***
CN114840597A (zh) * 2022-07-04 2022-08-02 杭州安恒信息技术股份有限公司 一种组件参数格式转换方法、装置、设备及存储介质
CN114840597B (zh) * 2022-07-04 2023-03-14 杭州安恒信息技术股份有限公司 一种组件参数格式转换方法、装置、设备及存储介质
CN115542882A (zh) * 2022-09-30 2022-12-30 东风汽车股份有限公司 一种控制器接口配置方法及装置
CN115542882B (zh) * 2022-09-30 2024-02-27 东风汽车股份有限公司 一种控制器接口配置方法及装置

Also Published As

Publication number Publication date
CN106528744A (zh) 2017-03-22

Similar Documents

Publication Publication Date Title
WO2018076815A1 (zh) 格式转换方法及***
US11222178B2 (en) Text entity extraction method for extracting text from target text based on combination probabilities of segmentation combination of text entities in the target text, apparatus, and device, and storage medium
WO2018040899A1 (zh) 搜索词纠错方法及装置
CN103631802B (zh) 歌曲信息检索方法、装置及相应的服务器
CN107221328B (zh) 修改源的定位方法及装置、计算机设备及可读介质
WO2015096564A1 (zh) 一种在线语音翻译方法和装置
CN110164435A (zh) 语音识别方法、装置、设备及计算机可读存储介质
CN105072130B (zh) 一种asn.1解码器代码自动生成方法
WO2019223437A1 (zh) 一种语音翻译方法及装置
WO2020155740A1 (zh) 信息查询方法、装置、计算机设备及存储介质
WO2020199423A1 (zh) Yang模型配置界面的自动化构建方法及***
WO2022105493A1 (zh) 基于语义识别的数据查询方法、装置、设备及存储介质
CN105138575A (zh) 语音文本串的解析方法和装置
CN103336788A (zh) 一种仿人机器人辅助的互联网信息获取方法及***
US20160019266A1 (en) Query generating method and query generating device
CN103631966A (zh) 一种可配置的解析多值匹配字段的方法
CN104252531A (zh) 一种文件类型识别方法及装置
CN111367890A (zh) 一种数据迁移的方法、装置、计算机设备及可读存储介质
US20140149854A1 (en) Server and method for generating object document
CN113850081B (zh) 基于人工智能的文本处理方法、装置、设备及介质
CN101645073A (zh) 一种将已有数据库文件导入嵌入式数据库的方法
CN112905620A (zh) 数据查询方法及装置、电子设备、存储介质
WO2017172956A1 (en) Generating source code for creating database triggers
CN105095180A (zh) 一种中文人名播报方法及装置
CN110890090A (zh) 基于上下文的辅助交互控制方法及***

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 17864694

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 17864694

Country of ref document: EP

Kind code of ref document: A1