WO2018076815A1 - Format conversion method and system - Google Patents

Format conversion method and system 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
French (fr)
Chinese (zh)
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/en

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

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

Disclosed are a format conversion method and system. The format conversion method comprises: recognizing a file format of an imported import file (101); if the file format of the import file matches a pre-set file format, parsing the import file (102); and according to a pre-set target file generation method, generating a target file from the parsed data (103). During the process of conversion of a file format, the format conversion system can automatically convert a file imported by a user to a target file, and the user does not need to carry out operation, thereby reducing the operating cost, improving the accuracy of file format conversion, and improving the reliability and interactivity of software during the process of software interaction.

Description

格式转换方法及系统Format conversion method and system 技术领域Technical field
本申请涉及数据处理领域,尤其涉及一种格式转换方法及系统。The present application relates to the field of data processing, and in particular, to a format conversion method and system.
背景技术Background technique
随着现代社会的发展,使得计算机技术以及相应的软件产品一直处于增长的状态。各行各业在生产过程中均需要使用软件产品,面对庞大的软件产品需求,如何提高软件的生产效率,降低成本,成为各行各业所需要解决的问题。With the development of modern society, computer technology and corresponding software products have been growing. All walks of life need to use software products in the production process. Faced with the huge demand for software products, how to improve the production efficiency of software and reduce costs has become a problem that all walks of life need to solve.
在软件的交互过程中,会使用多种协议,例如,使用控制器局域网络协议。现有技术中,控制器局域网络协议是用户与工程师共同开发的,双方在交互过程中使用的数据内容基于excel文件。In the process of software interaction, multiple protocols are used, for example, using a controller area network protocol. In the prior art, 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.
用户与用户在使用软件进行交互的过程中,通常使用手动编写代码来完成,由于用户与用户之间会有不同的语言习惯,并且在编写代码的过程中容易出现编写错误,从而导致软件的可靠性较差的问题。Users and users in the process of using software to interact, usually use manual code to complete, because the user and the user will have different language habits, and in the process of writing code is prone to writing errors, resulting in software reliability Poor sex.
申请内容Application content
本申请实施例提供一种格式转换方法及系统,实现了在软件交互的过程中,提高软件的可靠性。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:
识别导入的导入文件的文件格式;Identify the file format of the imported import file;
若所述导入文件的文件格式与预设的文件格式相匹配,对所述导入文件进行解析;If the file format of the imported file matches the preset file format, parsing the imported file;
根据预设的目标文件生成方式,将解析后的数据生成目标文件。The parsed data is generated into a target file according to a preset target file generation method.
进一步地,上述方法中,所述识别导入的导入文件的文件格式之前,所述方法还包括:Further, in the above method, before the identifying the file format of the imported import file, the method further includes:
接收用户导入的所述导入文件。Receiving the import file imported by the user.
进一步地,上述方法中,所述若所述导入文件的文件格式与预设的文件格式相匹配,对所述导入文件进行解析,包括: Further, in the above method, if the file format of the import file matches the preset file format, parsing the import file includes:
若所述导入文件的文件格式与预设的文件格式相匹配,确定所述导入文件的内容是否完整;If the file format of the imported file matches the preset file format, determine whether the content of the imported file is complete;
若所述导入文件的内容完整,对所述导入文件按照所述目标文件生成方式进行解析。If the content of the import file is complete, the import file is parsed according to the target file generation manner.
进一步地,上述方法中,所述若所述导入文件的内容完整,对所述导入文件按照所述目标文件生成方式进行解析,包括:Further, in the above method, if the content of the import file is complete, parsing the import file according to the target file generating manner includes:
对所述导入文件中的指定位置的数据进行提取;Extracting data of a specified location in the import file;
将提取到的数据按照指定格式进行调整,得到指定格式数据。The extracted data is adjusted according to the specified format to obtain the specified format data.
进一步地,上述方法中,根据预设的目标文件生成方式,将解析后的数据生成目标文件,包括:Further, in the above method, according to a preset target file generation manner, the parsed data is generated into an object file, including:
根据数据库文件生成方式,将一部分所述指定格式数据生成数据库文件;以及,Generating a database file from a portion of the specified format data according to a database file generation manner;
根据源代码文件生成方式,将另一部分所述指定格式数据生成源代码文件。According to 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.
进一步地,上述系统中,所述系统还包括:Further, in the above system, the system further includes:
接收模块,用于接收用户导入的所述导入文件。a receiving module, configured to receive the import file imported by a user.
进一步地,上述系统中,所述解析模块,具体用于:Further, in the above system, the parsing module is specifically configured to:
若所述导入文件的文件格式与预设的文件格式相匹配,确定所述导入文件的内容是否完整;If the file format of the imported file matches the preset file format, determine whether the content of the imported file is complete;
若所述导入文件的内容完整,对所述导入文件按照所述目标文件生成方式进行解析。If the content of the import file is complete, the import file is parsed according to the target file generation manner.
进一步地,上述系统中,所述解析模块,具体用于:Further, in the above system, the parsing module is specifically configured to:
对所述导入文件中的指定位置的数据进行提取;Extracting data of a specified location in the import file;
将提取到的数据按照指定格式进行调整,得到指定格式数据。 The extracted data is adjusted according to the specified format to obtain the specified format data.
进一步地,上述系统中,所述生成模块,具体用于:Further, in the above system, the generating module is specifically configured to:
根据数据库文件生成方式,将一部分所述指定格式数据生成数据库文件;以及,Generating a database file from a portion of the specified format data according to a database file generation manner;
根据源代码文件生成方式,将另一部分所述指定格式数据生成源代码文件。According 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.
附图说明DRAWINGS
为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作一简单地介绍,显而易见地,下面描述中的附图是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, a brief description of the drawings used in the embodiments or the prior art description will be briefly described below. Obviously, the drawings in the following description It is a certain embodiment of the present application, and other drawings can be obtained according to the drawings without any creative labor for those skilled in the art.
图1为本申请实施例提供的格式转换方法实施例一的流程图;FIG. 1 is a flowchart of Embodiment 1 of a format conversion method according to an embodiment of the present application;
图2为本申请实施例提供的格式转换方法实施例二的流程图;FIG. 2 is a flowchart of Embodiment 2 of a format conversion method according to an embodiment of the present disclosure;
图3为本申请实施例提供的格式转换方法实施例三的流程图;FIG. 3 is a flowchart of Embodiment 3 of a format conversion method according to an embodiment of the present disclosure;
图4为本申请实施例提供的格式转换系统实施例一的结构示意图;FIG. 4 is a schematic structural diagram of Embodiment 1 of a format conversion system according to an embodiment of the present disclosure;
图5为本申请实施例提供的格式转换系统实施例二的结构示意图。FIG. 5 is a schematic structural diagram of Embodiment 2 of a format conversion system according to an embodiment of the present disclosure.
具体实施方式detailed description
为使本申请实施例的目的、技术方案和优点更加清楚,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。基于 本申请中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。The technical solutions in the embodiments of the present application are clearly and completely described in the following with reference to the accompanying drawings in the embodiments of the present application. It is a part of the embodiments of the present application, and not all of the embodiments. based on All other embodiments obtained by those skilled in the art without any inventive work are within the scope of the present application.
实施例一Embodiment 1
图1为本申请实施例提供的格式转换方法实施例一的流程图,如图1所示,本实施例的格式转换方法,具体可以包括如下步骤: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:
101、识别导入的导入文件的文件格式。101. Identify the file format of the imported import file.
用户在使用计算机的时候会保存多种文件格式的文件,例如,excel文件、word文件、PPT文件等,因此,在格式转换过程中,首选要对文件的文件格式进行设定,在本申请实施例中,以文件格式为excel的文件进行举例说明,在实际应用中,还可以设定其他的文件格式。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. In the example, the file format is excel, for example, in the actual application, other file formats can also be set.
需要说明的是,在本申请实施例中,格式转换方法应用于格式转换系统中,且编写格式转换系统时所使用的语言为高级编程语言C#,在实际应用中,并不限制于使用高级编程语言C#这一种语言,还可以使用其他语言来编写格式转换系统。It should be noted that, in the embodiment of the present application, 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.
在本申请实施例中,预先在格式转换系统中,设定对文件格式为excel的文件进行格式转换,因此,首选需要识别用户导入的导入文件的文件格式是否为excel格式。In the embodiment of the present application, in the 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.
102、若导入文件的文件格式与预设的文件格式相匹配,对导入文件进行解析。102. If the file format of the imported file matches the preset file format, parse the imported file.
当用户导入文件后,格式转换系统自动对导入的文件进行识别,当导入的文件格式与预设的文件格式相匹配时,即可以认定为格式转换系统可以开始对导入的文件进行解析,当导入的文件格式与预设的文件格式不匹配时,则格式转换系统可以提示用户导入文件的文件格式有误,请用户进行核对。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.
在本申请实施例中,在对导入文件进行解析的过程中,可以利用支持跨平台类库来对导入文件进行解析,例如使用ExcelDataReader(数据处理类库)来对导入文件进行解析。In the embodiment of the present application, in the process of parsing the import file, the cross-platform class library can be used to parse the import file, for example, using an ExcelDataReader (data processing class library) to parse the import file.
103、根据预设的目标文件生成方式,将解析后的数据生成目标文件。103. Generate a target file by using the parsed data according to a preset target file generation manner.
在本申请实施例中,可以预先设定目标文件生成方式,目标文件生成方式可以根据用户的需要进行设定,以实现有利于用户进行交互的目的。例如,利用高级编程语言C#的多线程技术,创建至少一个任务,每个任务即为一个 目标文件生成方式,且每个目标文件生成方式均可以用于不同的用户使用。In the embodiment of the present application, 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.
然后,将对导入的excel文件解析后生成的数据,依照预设的目标生成方式来生成相应的目标文件,该目标文件可以直接发送至用户所在的计算机,也可以存储在格式转换系统所在的计算机的只读存储器中。Then, 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. In read-only memory.
需要说明的是,在本申请实施例中,格式转换系统可以是单独的一个系统软件,也可以集成在其他软件中。It should be noted that, in the embodiment of the present application, 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.
实施例二Embodiment 2
图2为本申请实施例提供的格式转换方法实施例二的流程图,如图2所示,本实施例的格式转换方法,具体可以包括如下步骤: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:
201、接收用户导入的导入文件。201. Receive an import file imported by 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.
202、识别导入的导入文件的文件格式。202. Identify the file format of the imported import file.
203、判断导入文件的文件格式与预设的文件格式是否匹配,若匹配,执行步骤204,若不匹配,执行步骤205。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.
204、对导入文件进行解析,执行步骤206。204. Parse the import file, and perform step 206.
具体地,在本申请实施例中,若导入文件的文件格式与预设的文件格式相匹配,确定导入文件的内容是否完整,若导入文件的内容完整,对导入文件按照目标文件生成方式进行解析。Specifically, in the embodiment of the present application, if 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. .
可以理解的是,为了保障格式转换结果与用户预期的转换结果相同,需要对导入文件的内容完整性进行判断,当导入文件的内容不完整,可以提示 用户导入文件有误,需用户重新导入,或者格式转换系统将停止运行。若导入文件的内容完整,对导入文件按照目标文件生成方式进行解析。It can be understood that, in order to ensure that the format conversion result is the same as the conversion result expected by the user, 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.
例如,预设的文件格式为EXCEL文件,文件中具备一个表格,表格中具备消息名称、消息长度、消息发送方、消息接收方四列表头时,导入文件的内容完整。用户导入一个文件格式为EXCEL的表格,如表1所示,表格中具备消息名称、消息长度、消息发送方、消息接收方四列表头,则可以检测出,用户导入的文件格式与预设的文件格式匹配且内容完整,然后,对导入文件按照目标文件生成方式进行解析。For example, the default file format is an EXCEL file, and 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.
消息名称Message name 消息长度Message length 消息发送方Message sender 消息接收方Message receiver
……...... ……...... ……...... ……......
……...... ……...... ……...... ……......
……...... ……...... ……...... ……......
表1Table 1
205、提示用户导入的导入文件格式错误。205. The format of the import file that the user is prompted to import is incorrect.
例如,预设的文件格式为EXCEL文件,用户导入一个文件格式为WORD的文件,则提示用户导入的导入文件格式错误。For example, 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.
206、根据预设的目标文件生成方式,将解析后的数据生成目标文件。206. Generate a target file by using the parsed data according to a preset target file generation manner.
本申请实施例提供的格式转换方法,利用格式转换系统首先接收用户导入的导入文件,并确认导入文件的格式与预设的格式是否匹配,并在确定格式匹配后将用户导入的导入文件进行解析,然后根据格式转换系统中预设的目标文件生成方式将解析后的数据生成目标文件,因此,在本申请技术方案中,在文件格式的转换过程中,格式转换系统可以自动将用户导入的文件转换成目标文件,用户无需进行操作,降低了操作成本,提高了文件格式转换的准确性,在软件交互的过程中,提高软件的可靠性,解决了现有技术中用户与用户在使用软件进行交互过程中,用户容易出现编写错误,导致软件的可靠性较差的问题。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.
实施例三Embodiment 3
图3为本申请实施例提供的格式转换方法实施例三的流程图,如图3所示,本实施例的格式转换方法,具体可以包括如下步骤: 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:
301、接收用户导入的导入文件。301. Receive an import file imported by a user.
302、识别导入的导入文件的文件格式。302. Identify the file format of the imported import file.
303、将导入文件存储在只读存储器中。303. Store the import file in a read-only memory.
在本申请实施例中,用户在导入了导入文件后,若用户不需要立即对该导入文件进行格式的转换,可以存储在只读存储器中。若用户需要对多个导入文件进行格式转换,用户在导入了所有的导入文件后,也可以将多个导入文件存储在只读存储器中,待用户需要对多个导入文件进行格式转换时,格式转换系统可以从只读存储器中调取格式文件。In the embodiment of the present application, after the user imports the import file, if the user does not need to immediately convert the format of the import file, 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.
304、判断导入的导入文件的文件格式与预设的文件格式是否匹配,若匹配,执行步骤305,若不匹配,执行步骤306。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.
305、对导入文件进行解析,执行步骤307。305. Parse the import file, and perform step 307.
在本申请实施例中,在上述实施例二中步骤204的基础上,可以包括:In the embodiment of the present application, based on the step 204 in the foregoing Embodiment 2, the method may include:
对导入文件中的指定位置的数据进行提取;Extract data from a specified location in the import file;
将提取到的数据按照指定格式进行调整,得到指定格式数据。The extracted data is adjusted according to the specified format to obtain the specified format data.
具体地,在本申请实施例中,以预设的文件格式为EXCEL文件为例进行说明,指定位置可以是EXCEL文件的表格中每一列的表头,如表2所示,Specifically, in the embodiment of the present application, 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.
消息名称Message name 消息长度Message length 消息发送方Message sender 消息接收方Message receiver
11 1616 001001 002002
22 3232 002002 003003
33 4848 003003 004004
表2Table 2
例如,表格中具备消息名称、消息长度、消息发送方、消息接收方四列表头,则该表格中指定位置有四个,分别为消息名称、消息长度、消息发送方、消息接收方。然后依次提取每行数据中,每一个指定位置所在列的数据,例如,提取第一行数据为1、16、001、002。For example, if 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.
然后,设定指定格式为:消息名称_消息长度_消息发送方_消息接收方,则依次将表格中提取到的每行数据调整为该指定格式数据,例如,第一行指定格式数据为1_16_001_002。Then, 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 .
需要说明的是,在本申请实施例中,指定位置可以有多个,其根据具体的目标文件生成方式进行设定,相应的指定格式也可以由多个,在本申请实 施例中,仅列举其中一种目标文件生成方式进行说明,在实际应用中,并不限制于该种目标文件生成方式。It should be noted that, in the embodiment of the present application, there may be multiple designated locations, which are set according to a specific target file generation manner, and the corresponding specified format may also be multiple. In the example, only one of the object file generation methods is described. In practical applications, it is not limited to the target file generation method.
306、提示用户导入的导入文件格式错误。306. The format of the import file that the user is prompted to import is incorrect.
307、根据预设的目标文件生成方式,将解析后的数据生成目标文件。307. Generate a target file by using the parsed data according to a preset target file generation manner.
根据数据库文件生成方式,将一部分指定格式数据生成数据库文件;以及,Generate a database file from a portion of the specified format data according to the way the database file is generated; and,
根据源代码文件生成方式,将另一部分指定格式数据生成源代码文件。According to the source code file generation method, another part of the specified format data is generated into a source code file.
具体地,在本申请实施例中,预设的目标文件生产方式包括两种,一种为数据库文件生成方式,另一种为源代码文件生成方式,每种目标文件生成格式对应一种目标文件。其中,数据库文件生成方式所对应的目标文件为文件名的后缀为.DBC的目标文件,源代码文件生成方式所对应的为文件名的后缀为.c或.h的目标文件。Specifically, in the embodiment of the present application, 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.
根据预设的目标文件生成方式,将步骤305中,解析后所生成指定格式数据进行编辑,生成相应的目标文件。例如,使用正则表达式对解析后所生成一部分指定格式数据进行编辑,生成文件名为XXX.c目标文件。According to the preset target file generation manner, the specified format data generated after parsing in step 305 is edited to generate a corresponding target file. For example, 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.
实施例四Embodiment 4
图4为本申请实施例提供的格式转换系统实施例一的结构示意图,如图4所示,本实施例的格式转换系统可以包括:识别模块11、解析模块12和生成模块。FIG. 4 is a schematic structural diagram of Embodiment 1 of a format conversion system according to an embodiment of the present disclosure. As shown in FIG. 4, the format conversion system of this embodiment may include: an identification module 11, a parsing module 12, and a generating module.
识别模块11,用于识别导入的导入文件的文件格式。 The identification module 11 is configured to identify a file format of the imported import file.
解析模块12,用于若识别模块11识别的导入文件的文件格式与预设的文件格式相匹配,对导入文件进行解析。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.
生成模块13,用于根据预设的目标文件生成方式,将解析模块12解析后的数据生成目标文件。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.
本实施例的系统,可以用于执行图1所示方法实施例的技术方案,其实现原理和技术效果类似,此处不再赘述。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.
实施例五Embodiment 5
图5为本申请实施例提供的格式转换系统实施例二的结构示意图,如图5所示,本实施例的格式转换系统在实施例四的基础上,还可以包括:接收模块14。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.
接收模块14,用于接收用户导入的导入文件。The receiving module 14 is configured to receive an import file imported by the user.
具体地,解析模块12,具体用于:Specifically, the parsing module 12 is specifically configured to:
若导入文件的文件格式与预设的文件格式相匹配,确定导入文件的内容是否完整;If the file format of the imported file matches the preset file format, determine 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 method.
本实施例的系统,可以用于执行图2所示方法实施例的技术方案,其实现原理和技术效果类似,此处不再赘述。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.
实施例五Embodiment 5
本实施例的格式转换系统在实施例五的基础上,解析模块12,具体用于:The format conversion system of this embodiment is based on the fifth embodiment, and the parsing module 12 is specifically configured to:
对导入文件中的指定位置的数据进行提取;Extract data from a specified location in the import file;
将提取到的数据按照指定格式进行调整,得到指定格式数据。The extracted data is adjusted according to the specified format to obtain the specified format data.
生成模块13,具体用于:The generating module 13 is specifically configured to:
根据数据库文件生成方式,将一部分指定格式数据生成数据库文件;以及,Generate a database file from a portion of the specified format data according to the way the database file is generated; and,
根据源代码文件生成方式,将另一部分指定格式数据生成源代码文件。According to the source code file generation method, another part of the specified format data is generated into a source code file.
本实施例的系统,可以用于执行图3所示方法实施例的技术方案,其实现原理和技术效果类似,此处不再赘述。 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.
本领域普通技术人员可以理解:实现上述各方法实施例的全部或部分步骤可以通过程序指令相关的硬件来完成。前述的程序可以存储于一计算机可读取存储介质中。该程序在执行时,执行包括上述各方法实施例的步骤;而前述的存储介质包括:ROM、RAM、磁碟或者光盘等各种可以存储程序代码的介质。One of ordinary skill in the art will appreciate that all or part of the steps to implement the various method embodiments described above may be accomplished by hardware associated with the program instructions. 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.
最后应说明的是:以上各实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述各实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分或者全部技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的范围。 Finally, it should be noted that the above embodiments are only for explaining the technical solutions of the present application, and are not limited thereto; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that The technical solutions described in the foregoing embodiments may be modified, or some or all of the technical features may be equivalently replaced; and the modifications or substitutions do not deviate from the technical solutions of the embodiments of the present application. range.

Claims (10)

  1. 一种格式转换方法,其特征在于,包括:A format conversion method, comprising:
    识别导入的导入文件的文件格式;Identify the file format of the imported import file;
    若所述导入文件的文件格式与预设的文件格式相匹配,对所述导入文件进行解析;If the file format of the imported file matches the preset file format, parsing the imported file;
    根据预设的目标文件生成方式,将解析后的数据生成目标文件。The parsed data is generated into a target file according to a preset target file generation method.
  2. 根据权利要求1所述的方法,其特征在于,所述识别导入的导入文件的文件格式之前,所述方法还包括:The method according to claim 1, wherein before the identifying the file format of the imported import file, the method further comprises:
    接收用户导入的所述导入文件。Receiving the import file imported by the user.
  3. 根据权利要求1所述的方法,其特征在于,所述若所述导入文件的文件格式与预设的文件格式相匹配,对所述导入文件进行解析,包括:The method according to claim 1, wherein if the file format of the import file matches a preset file format, parsing the import file includes:
    若所述导入文件的文件格式与预设的文件格式相匹配,确定所述导入文件的内容是否完整;If the file format of the imported file matches the preset file format, determine whether the content of the imported file is complete;
    若所述导入文件的内容完整,对所述导入文件按照所述目标文件生成方式进行解析。If the content of the import file is complete, the import file is parsed according to the target file generation manner.
  4. 根据权利要求3所述的方法,其特征在于,所述若所述导入文件的内容完整,对所述导入文件按照所述目标文件生成方式进行解析,包括:The method according to claim 3, wherein if the content of the import file is complete, the import file is parsed according to the target file generating manner, including:
    对所述导入文件中的指定位置的数据进行提取;Extracting data of a specified location in the import file;
    将提取到的数据按照指定格式进行调整,得到指定格式数据。The extracted data is adjusted according to the specified format to obtain the specified format data.
  5. 根据权利要求4所述的方法,其特征在于,根据预设的目标文件生成方式,将解析后的数据生成目标文件,包括:The method according to claim 4, wherein the parsed data is generated into an object file according to a preset target file generation manner, including:
    根据数据库文件生成方式,将一部分所述指定格式数据生成数据库文件;以及,Generating a database file from a portion of the specified format data according to a database file generation manner;
    根据源代码文件生成方式,将另一部分所述指定格式数据生成源代码文件。According to the source code file generation method, another part of the specified format data is generated to generate a source code file.
  6. 一种格式转换系统,其特征在于,包括:A format conversion system, comprising:
    识别模块,用于识别导入的导入文件的文件格式;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;
    生成模块,用于根据预设的目标文件生成方式,将解析后的数据生成目 标文件。a generation module for generating the parsed data according to a preset target file generation manner Standard file.
  7. 根据权利要求6所述的系统,其特征在于,所述系统还包括:The system of claim 6 wherein the system further comprises:
    接收模块,用于接收用户导入的所述导入文件。a receiving module, configured to receive the import file imported by a user.
  8. 根据权利要求6所述的系统,其特征在于,所述解析模块,具体用于:The system according to claim 6, wherein the parsing module is specifically configured to:
    若所述导入文件的文件格式与预设的文件格式相匹配,确定所述导入文件的内容是否完整;If the file format of the imported file matches the preset file format, determine whether the content of the imported file is complete;
    若所述导入文件的内容完整,对所述导入文件按照所述目标文件生成方式进行解析。If the content of the import file is complete, the import file is parsed according to the target file generation manner.
  9. 根据权利要求8所述的系统,其特征在于,所述解析模块,具体用于:The system according to claim 8, wherein the parsing module is specifically configured to:
    对所述导入文件中的指定位置的数据进行提取;Extracting data of a specified location in the import file;
    将提取到的数据按照指定格式进行调整,得到指定格式数据。The extracted data is adjusted according to the specified format to obtain the specified format data.
  10. 根据权利要求9所述的系统,其特征在于,所述生成模块,具体用于:The system according to claim 9, wherein the generating module is specifically configured to:
    根据数据库文件生成方式,将一部分所述指定格式数据生成数据库文件;以及,Generating a database file from a portion of the specified format data according to a database file generation manner;
    根据源代码文件生成方式,将另一部分所述指定格式数据生成源代码文件。 According to the source code file generation method, another part of the specified format data is generated to generate a source code file.
PCT/CN2017/093198 2016-10-28 2017-07-17 Format conversion method and system WO2018076815A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201610966320.1 2016-10-28
CN201610966320.1A CN106528744A (en) 2016-10-28 2016-10-28 Format conversion method and system

Publications (1)

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

Family

ID=58325904

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/093198 WO2018076815A1 (en) 2016-10-28 2017-07-17 Format conversion method and system

Country Status (2)

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

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109325217A (en) * 2018-09-19 2019-02-12 深圳市元征科技股份有限公司 A kind of document conversion method, system, device and computer readable storage medium
CN113965776A (en) * 2021-10-20 2022-01-21 江下信息科技(惠州)有限公司 Multi-mode audio and video format high-speed conversion method and system
CN114840597A (en) * 2022-07-04 2022-08-02 杭州安恒信息技术股份有限公司 Component parameter format conversion method, device, equipment and storage medium
CN115542882A (en) * 2022-09-30 2022-12-30 东风汽车股份有限公司 Controller interface configuration method and device

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106528744A (en) * 2016-10-28 2017-03-22 宁德时代新能源科技股份有限公司 Format conversion method and system
CN107247697A (en) * 2017-07-05 2017-10-13 上海蔚赫信息科技有限公司 A kind of method that Excel file is converted to automotive networking DBC files
CN110347641B (en) * 2019-06-26 2022-04-26 北京明略软件系统有限公司 File processing method and device, storage medium and electronic device
CN110533776A (en) * 2019-08-31 2019-12-03 王亚亚 A kind of high-precision oblique photograph modeling method
CN111552665B (en) * 2020-04-27 2023-08-01 光际科技(上海)有限公司 Method, device, equipment and medium for converting annotation information format
CN113190504A (en) * 2021-05-27 2021-07-30 北京一雄信息科技有限公司 File format conversion method and system
CN113660156B (en) * 2021-08-09 2022-10-21 覃飞 Processing method and device for transmission file, electronic equipment and storage medium
CN116594960B (en) * 2023-06-08 2024-01-30 镁佳(北京)科技有限公司 Descriptive file format conversion method, descriptive file format conversion device, computer equipment and storage medium

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 (en) * 2013-09-02 2014-01-01 用友软件股份有限公司 Device and method for conducting self-matching on data formats
CN104217396A (en) * 2014-09-11 2014-12-17 广西桂能软件有限公司 DWG (drawing) file format conversion method
CN105245943A (en) * 2015-09-28 2016-01-13 北京奇艺世纪科技有限公司 Method and device for matching subtitle file for local video file
CN106528744A (en) * 2016-10-28 2017-03-22 宁德时代新能源科技股份有限公司 Format conversion method and system

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 (en) * 2013-09-02 2014-01-01 用友软件股份有限公司 Device and method for conducting self-matching on data formats
CN104217396A (en) * 2014-09-11 2014-12-17 广西桂能软件有限公司 DWG (drawing) file format conversion method
CN105245943A (en) * 2015-09-28 2016-01-13 北京奇艺世纪科技有限公司 Method and device for matching subtitle file for local video file
CN106528744A (en) * 2016-10-28 2017-03-22 宁德时代新能源科技股份有限公司 Format conversion method and system

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109325217A (en) * 2018-09-19 2019-02-12 深圳市元征科技股份有限公司 A kind of document conversion method, system, device and computer readable storage medium
CN109325217B (en) * 2018-09-19 2023-04-18 深圳市元征科技股份有限公司 File conversion method, system, device and computer readable storage medium
CN113965776A (en) * 2021-10-20 2022-01-21 江下信息科技(惠州)有限公司 Multi-mode audio and video format high-speed conversion method and system
CN113965776B (en) * 2021-10-20 2022-07-05 江下信息科技(惠州)有限公司 Multi-mode audio and video format high-speed conversion method and system
CN114840597A (en) * 2022-07-04 2022-08-02 杭州安恒信息技术股份有限公司 Component parameter format conversion method, device, equipment and storage medium
CN114840597B (en) * 2022-07-04 2023-03-14 杭州安恒信息技术股份有限公司 Component parameter format conversion method, device, equipment and storage medium
CN115542882A (en) * 2022-09-30 2022-12-30 东风汽车股份有限公司 Controller interface configuration method and device
CN115542882B (en) * 2022-09-30 2024-02-27 东风汽车股份有限公司 Controller interface configuration method and device

Also Published As

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

Similar Documents

Publication Publication Date Title
WO2018076815A1 (en) Format conversion method and system
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 (en) Error correction method and device for search term
CN103631802B (en) Song information searching method, device and corresponding server
CN107221328B (en) Method and device for positioning modification source, computer equipment and readable medium
CN111177184A (en) Structured query language conversion method based on natural language and related equipment thereof
WO2015096564A1 (en) On-line voice translation method and device
RU2351007C2 (en) System and method of supporting "extrinsic" xml and "intrinsic" xml in text processor document
CN110164435A (en) Audio recognition method, device, equipment and computer readable storage medium
CN105072130B (en) A kind of ASN.1 decoders code automatic generation method
WO2019223437A1 (en) Speech translation method and apparatus
WO2020199423A1 (en) Automated construction method and system for yang model configuration interface
CN103336788A (en) Humanoid robot added Internet information acquisition method and system
WO2020155740A1 (en) Information query method and apparatus, and computer device and storage medium
WO2022105493A1 (en) Semantic recognition-based data query method and apparatus, device and storage medium
CN113986968A (en) Scheme intelligent proofreading method based on electric power standard standardization datamation
US20140149854A1 (en) Server and method for generating object document
CN112231407A (en) DDL synchronization method, device, equipment and medium of PostgreSQL database
CN111367890A (en) Data migration method and device, computer equipment and readable storage medium
CN112905620A (en) Data query method and device, electronic equipment and storage medium
TWI746520B (en) Method and device for compiling computer language
CN106326314B (en) Webpage information extraction method and device
CN106776275A (en) A kind of testing process automatic generation method based on Packet Multiplexing
US9613090B2 (en) Simplified query generation from prior query results
CN110890090A (en) Context-based auxiliary interaction control method and system

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