CN112861482A - File online editing method - Google Patents

File online editing method Download PDF

Info

Publication number
CN112861482A
CN112861482A CN202110174847.1A CN202110174847A CN112861482A CN 112861482 A CN112861482 A CN 112861482A CN 202110174847 A CN202110174847 A CN 202110174847A CN 112861482 A CN112861482 A CN 112861482A
Authority
CN
China
Prior art keywords
file
xml
word
tag
editing
Prior art date
Legal status (The legal status 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 status listed.)
Pending
Application number
CN202110174847.1A
Other languages
Chinese (zh)
Inventor
张世彤
张�杰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
INST OF SCIENT AND TECHNICAL INFORMATION OF JILIN PROVINCE
Original Assignee
INST OF SCIENT AND TECHNICAL INFORMATION OF JILIN PROVINCE
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 INST OF SCIENT AND TECHNICAL INFORMATION OF JILIN PROVINCE filed Critical INST OF SCIENT AND TECHNICAL INFORMATION OF JILIN PROVINCE
Priority to CN202110174847.1A priority Critical patent/CN112861482A/en
Publication of CN112861482A publication Critical patent/CN112861482A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/166Editing, e.g. inserting or deleting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/80Information retrieval; Database structures therefor; File system structures therefor of semi-structured data, e.g. markup language structured data such as SGML, XML or HTML
    • G06F16/84Mapping; Conversion
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/958Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking
    • G06F16/986Document structures and storage, e.g. HTML extensions

Abstract

The invention discloses a method for editing files online, which comprises the following steps: when an editing request is received, acquiring a WORD file from a hard disk of a server; decompressing the WORD file through an open source program docx4j, and storing the WORD file as an XML format file; analyzing the XML format file; comparing each tag in the XML formatted file with a WORD tag library so as to determine the meaning of each tag in the XML formatted file; converting each tag in the XML-formatted file into a corresponding HTML tag according to the meaning of each tag in the XML-formatted file; and setting a custom attribute in the HTML tag. The online file editing method can be used for online editing of WORD files on HTML web pages.

Description

File online editing method
Technical Field
The present invention relates to the field of computer technology, and more particularly to a method for editing a file online.
Background
WORD is a very powerful and commonly used office application software, and can perform WORD processing, document editing, table making, style creation and application, other conventional operations (e.g. mail merging, spelling and grammar checking, etc.), document printing, page setting, etc., and is very widely used.
The inventor finds that if the WORD is needed to edit the file, office software must be installed locally, on one hand, a large amount of computer hard disk space is occupied, and on the other hand, once the user computer has a problem, the file stored on the computer is lost and cannot be retrieved, so that great loss is caused to the user; in addition, when a user uses a desktop computer, the user cannot edit own files at any place, and only can copy and save the files through a mobile storage device.
The information disclosed in this background section is only for enhancement of understanding of the general background of the invention and should not be taken as an acknowledgement or any form of suggestion that this information forms the prior art already known to a person skilled in the art.
Disclosure of Invention
The invention aims to provide a file online editing method which can perform online editing of WORD files on HTML web pages.
In order to achieve the above object, the present invention provides an online file editing method, which includes: when an editing request is received, acquiring a WORD file from a hard disk of a server; decompressing the WORD file through an open source program docx4j, and storing the WORD file as an XML format file; analyzing the XML format file; comparing each tag in the XML formatted file with a WORD tag library so as to determine the meaning of each tag in the XML formatted file; and converting each label in the XML-format file into a corresponding HTML label according to the meaning of each label in the XML-format file.
In an embodiment of the present invention, the method for editing a file online further includes: and setting a custom attribute in the HTML tag.
In an embodiment of the present invention, setting a custom attribute in the HTML tag includes: and adding an ap attribute in the HTML tag.
In an embodiment of the present invention, converting each tag in the XML-formatted file into a corresponding HTML tag includes: and converting each label in the XML format file into a corresponding HTML label by adopting a multithreading asynchronous simultaneous analysis method.
In an embodiment of the present invention, parsing the XML-formatted file includes: and parsing the XML-formatted file by using an open-source XML parsing package DOM 4J.
In an embodiment of the present invention, the method for editing a file online further includes: after receiving a storage request, converting an HTML source code of the edited WORD file into an XML format, and inquiring the custom attribute so as to obtain a modification position of the WORD file; updating the XML format file; reading the updated XML-formatted file through the open source program docx4j and converting the XML-formatted file into a WORD file.
In an embodiment of the present invention, the method for editing a file online further includes: and storing the WORD file into a hard disk of the server.
Based on the same inventive concept, the present invention further provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and running on the processor, wherein the processor executes the computer program to implement the steps of the method according to any of the above embodiments.
Based on the same inventive concept, the present invention also provides a non-transitory computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, implements the steps of the method according to any of the above embodiments.
Compared with the prior art, the file online editing method and the electronic device can be deployed in operating systems such as Windows, linux and android without modifying any code, and are easy to implement and maintain. In addition, according to the method, a user does not need to install Office software in a local or server, the user can open a webpage as long as the internet exists, the WORD file of the user can be directly checked and edited, the WORD file is stored in the cloud in real time, and the method has extremely high convenience.
Drawings
Fig. 1 is a block diagram of steps of a method for editing a file online according to an embodiment of the present invention.
Detailed Description
The following detailed description of the present invention is provided in conjunction with the accompanying drawings, but it should be understood that the scope of the present invention is not limited to the specific embodiments.
Throughout the specification and claims, unless explicitly stated otherwise, the word "comprise", or variations such as "comprises" or "comprising", will be understood to imply the inclusion of a stated element or component but not the exclusion of any other element or component.
In order to overcome the problems in the prior art, the invention provides a file online editing method which can perform online editing of WORD files on HTML web pages.
Fig. 1 is a block diagram of steps of a method for editing a file online according to an embodiment of the present invention.
In step S1, a WORD file is acquired: and when an editing request is received, acquiring the WORD file stored by the user from the hard disk of the server.
Format conversion of the WORD file is performed in step S2: and decompressing the WORD file through an open source program docx4j, and storing the WORD file as an XML format file.
The XML-formatted file is parsed in step S3. Optionally, the XML-formatted file is parsed by using an open-source XML parsing package DOM 4J.
The tag meaning is determined in step S4: and comparing each label in the XML-format file with a WORD label library so as to determine the meaning of each label in the XML-format file.
The conversion of the label is performed in step S5: and converting each label in the XML-format file into a corresponding HTML label according to the meaning of each label in the XML-format file. For example, the < w: p > tag in the XML is converted into the < p > tag of the paragraph in the HTML by comparing with the WORD tag library and determining that the meaning of the tag is "representing a paragraph".
Preferably, a multithreading asynchronous simultaneous parsing method can be adopted to convert each tag in the XML-formatted file into a corresponding HTML tag, so that parsing of the file can be accelerated, and even if the WORD file is too large, parsing can be completed quickly; the method and the device can be quickly presented on the page, and the user experience quality is improved.
Preferably, the custom attribute is set in the HTML tag in step S6. For example, an ap attribute is added to a < p > tag in a paragraph tag in HTML for use in post-edit save, which may indicate the location modified by the user after editing.
Through the implementation mode, the WORD file is converted into the form which can be edited by the HTML page, and a user can edit on the HTML webpage on line.
Preferably, in an embodiment, after the user finishes editing the content of the WORD file on the browser, the online file editing method further includes: after receiving a storage request, converting an HTML source code of the edited WORD file into an XML format, and inquiring the custom attribute so as to obtain a modification position of the WORD file; updating the XML format file; reading the updated XML-formatted file through the open source program docx4j and converting the XML-formatted file into a WORD file; and storing the WORD file into a hard disk of the server.
Based on the same inventive concept, an embodiment further provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and running on the processor, and when the processor executes the computer program, the steps of the method according to any of the above embodiments are implemented.
Based on the same inventive concept, an embodiment also provides a non-transitory computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, implements the steps of the method of any of the above embodiments.
In summary, according to the online file editing method and device of the embodiment, online editing can be performed on the WORD file on the HTML webpage, and the method can be deployed in operating systems such as Windows, linux, android and the like without modifying any code, and is easy to implement and maintain. In addition, according to the method, a user does not need to install Office software in a local or server, the user can open a webpage as long as the internet exists, the WORD file of the user can be directly checked and edited, the WORD file is stored in the cloud in real time, and the method has extremely high convenience.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
The foregoing descriptions of specific exemplary embodiments of the present invention have been presented for purposes of illustration and description. It is not intended to limit the invention to the precise form disclosed, and obviously many modifications and variations are possible in light of the above teaching. The exemplary embodiments were chosen and described in order to explain certain principles of the invention and its practical application to enable one skilled in the art to make and use various exemplary embodiments of the invention and various alternatives and modifications as are suited to the particular use contemplated. It is intended that the scope of the invention be defined by the claims and their equivalents.

Claims (9)

1. A method for editing a file online, comprising:
when an editing request is received, acquiring a WORD file from a hard disk of a server;
decompressing the WORD file through an open source program docx4j, and storing the WORD file as an XML format file;
analyzing the XML format file;
comparing each tag in the XML formatted file with a WORD tag library so as to determine the meaning of each tag in the XML formatted file;
and converting each label in the XML-format file into a corresponding HTML label according to the meaning of each label in the XML-format file.
2. The method for on-line editing of a file of claim 1, wherein parsing the XML-formatted file comprises:
and parsing the XML-formatted file by using an open-source XML parsing package DOM 4J.
3. The method for on-line editing of a file of claim 1, wherein converting each tag in the XML-formatted file into a corresponding HTML tag comprises:
and converting each label in the XML format file into a corresponding HTML label by adopting a multithreading asynchronous simultaneous analysis method.
4. The online editing method for files according to claim 1, further comprising:
and setting a custom attribute in the HTML tag.
5. The method of online editing of a file of claim 4, wherein setting custom properties in the HTML tag comprises:
and adding an ap attribute in the HTML tag.
6. The online editing method for files according to claim 1, further comprising:
after receiving a storage request, converting an HTML source code of the edited WORD file into an XML format, and inquiring the custom attribute so as to obtain a modification position of the WORD file;
updating the XML format file;
reading the updated XML-formatted file through the open source program docx4j and converting the XML-formatted file into a WORD file.
7. The online editing method for files according to claim 1, further comprising:
and storing the WORD file into a hard disk of the server.
8. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the steps of the method according to any of claims 1 to 7 are implemented when the processor executes the program.
9. A non-transitory computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 7.
CN202110174847.1A 2021-02-07 2021-02-07 File online editing method Pending CN112861482A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110174847.1A CN112861482A (en) 2021-02-07 2021-02-07 File online editing method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110174847.1A CN112861482A (en) 2021-02-07 2021-02-07 File online editing method

Publications (1)

Publication Number Publication Date
CN112861482A true CN112861482A (en) 2021-05-28

Family

ID=75989370

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110174847.1A Pending CN112861482A (en) 2021-02-07 2021-02-07 File online editing method

Country Status (1)

Country Link
CN (1) CN112861482A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113742624A (en) * 2021-09-03 2021-12-03 北京市律典通科技有限公司 Online plug-in-free browsing and editing processing method and device for Word document

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TWI248002B (en) * 2004-09-17 2006-01-21 Infopower Corp System and method of web-based editor for compound documents
CN102156742A (en) * 2011-04-19 2011-08-17 北京神州数码思特奇信息技术股份有限公司 Method and middleware for supporting structured document display with own browser of mobile phone
CN102163233A (en) * 2011-04-18 2011-08-24 北京神州数码思特奇信息技术股份有限公司 Method and system for converting webpage markup language format
CN105426480A (en) * 2015-11-19 2016-03-23 中国地质大学(武汉) Method and apparatus for converting HTML into Word document
CN105786788A (en) * 2016-03-22 2016-07-20 江苏国泰新点软件有限公司 Method and device for generating forms by using WORD program
CN108228777A (en) * 2017-12-28 2018-06-29 北京洪泰同创信息技术有限公司 Html text exports to the method and device of word document

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TWI248002B (en) * 2004-09-17 2006-01-21 Infopower Corp System and method of web-based editor for compound documents
CN102163233A (en) * 2011-04-18 2011-08-24 北京神州数码思特奇信息技术股份有限公司 Method and system for converting webpage markup language format
CN102156742A (en) * 2011-04-19 2011-08-17 北京神州数码思特奇信息技术股份有限公司 Method and middleware for supporting structured document display with own browser of mobile phone
CN105426480A (en) * 2015-11-19 2016-03-23 中国地质大学(武汉) Method and apparatus for converting HTML into Word document
CN105786788A (en) * 2016-03-22 2016-07-20 江苏国泰新点软件有限公司 Method and device for generating forms by using WORD program
CN108228777A (en) * 2017-12-28 2018-06-29 北京洪泰同创信息技术有限公司 Html text exports to the method and device of word document

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
周强 等: "基于dom4j转换XML为XHTML页面的方法", 《计算机技术与发展》 *
杨帆,赵义霞, 高等教育出版社 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113742624A (en) * 2021-09-03 2021-12-03 北京市律典通科技有限公司 Online plug-in-free browsing and editing processing method and device for Word document

Similar Documents

Publication Publication Date Title
US7802179B2 (en) Synchronizing data between different editor views
US8286077B2 (en) Remote batch editing of formatted text via an HTML editor
US10372792B2 (en) Document transformation performance via incremental fragment transformations
US9372689B2 (en) Synchronizing comments in source code with text documents
TW201732647A (en) Webpage script loading method and device
JP2011505605A5 (en)
CN106933887B (en) Data visualization method and device
EP2564314A2 (en) Client application and web page integration
CN110968989A (en) Method and device for displaying error correction information on front-end page
CN114138244A (en) Method and device for automatically generating model files, storage medium and electronic equipment
CN112329062A (en) Method and device for detecting hidden data and electronic equipment
CN115237436A (en) Application deployment method and device, electronic equipment and readable storage medium
CN112861482A (en) File online editing method
CN110569488A (en) modular template WORD generation method based on XML (extensive markup language)
CN109558548B (en) Method for eliminating CSS style redundancy and related product
US20110078552A1 (en) Transclusion Process
US7308398B2 (en) Translation correlation device
CN109977423B (en) Method and device for processing word, electronic equipment and readable storage medium
CN114168119B (en) Code file editing method, device, electronic equipment and storage medium
US9223766B2 (en) Preserving formatting of content selection through snippets
CN112861483A (en) Online editing method for demonstration manuscript
CN110928549B (en) Method and device for re-editing front-end script program
CN114048708A (en) Automatic typesetting method and system based on rich text editor
JP7000709B2 (en) Information processing equipment and programs
US20230409521A1 (en) Automatic preservation

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20210528

RJ01 Rejection of invention patent application after publication