WO2018040439A1 - 文档的处理方法及装置 - Google Patents

文档的处理方法及装置 Download PDF

Info

Publication number
WO2018040439A1
WO2018040439A1 PCT/CN2016/113398 CN2016113398W WO2018040439A1 WO 2018040439 A1 WO2018040439 A1 WO 2018040439A1 CN 2016113398 W CN2016113398 W CN 2016113398W WO 2018040439 A1 WO2018040439 A1 WO 2018040439A1
Authority
WO
WIPO (PCT)
Prior art keywords
attribute
attribute information
document
information
value
Prior art date
Application number
PCT/CN2016/113398
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 WO2018040439A1 publication Critical patent/WO2018040439A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/12Use of codes for handling textual entities

Definitions

  • the embodiments of the present invention relate to the field of computer application technologies, and in particular, to a method and an apparatus for processing a document.
  • An electronic document refers to a file stored in a computer in the form of data.
  • an electronic document is simply referred to as a document.
  • the document includes several elements, such as pictures, audio, video, etc.
  • the element includes several attributes.
  • the picture may include the following attributes: picture source and picture transparency, and the like.
  • the present invention provides a method and apparatus for processing a document to improve compatibility of the use of the document.
  • an embodiment of the present invention provides a method for processing a document, including: obtaining a display request of a document; and parsing first attribute information of an element in the document according to the display request; An attribute information, determining, according to the second attribute information of the element in the first application, a display manner of the element, where the second attribute information is in the first application.
  • the attribute definition information corresponding to the element to which the first attribute information belongs is described.
  • an embodiment of the present invention provides a file processing apparatus, including: a request obtaining unit, configured to acquire a display request of a document; and a parsing unit, connected to the request obtaining unit, according to the display request Parsing the first attribute information of the element in the document; the display unit is connected to the parsing unit, and configured to: if the first attribute information is not obtained by the parsing, according to the second attribute information of the element in the first application The method for displaying the element is determined, wherein the second attribute information is attribute definition information corresponding to the element to which the first attribute information belongs in the first application.
  • the display manner of the element is determined according to the second attribute information of the element in the first application for displaying the document, and the second attribute information is used. It is the attribute definition information of the element, so that when the document cannot be completely parsed, the elements in the document can be displayed to the greatest extent, and the compatibility of the use of the document is improved.
  • FIG. 1 is a flowchart of a method for processing a document according to Embodiment 1 of the present invention
  • FIG. 2 is a flowchart of a method for processing a document according to Embodiment 2 of the present invention
  • FIG. 3 is a schematic structural diagram of a processing apparatus of a document according to Embodiment 4 of the present invention.
  • the processing method and device for the document provided by the embodiment of the present invention are applied to a client computing device.
  • Documents are generated and edited by various applications, including but not limited to Microsoft Office (Windows-based office software suite developed by Microsoft Corporation), Adobe Acrobat (a portable document format developed by Adobe (Portable) Document Format, PDF) editing software, etc.
  • the client computing device may be a personal computer for running a document editing application, or a mobile terminal for running a document editing application, wherein the mobile terminal includes Tablets, personal digital assistants, and smartphones.
  • Embodiment 1 is a flowchart of a method for processing a document according to Embodiment 1 of the present invention.
  • the embodiment is applicable to a case where a software created by another software is opened, and a version of software is also applicable. Opening a document made by other versions of the same software, the method may be performed by a processing device of the document, the device may be implemented by software and/or hardware, the device may be integrated in any device capable of opening the document, for example Typical are user terminal devices such as cell phones, computers, and the like.
  • the first application is different from the second application, and/or the first application is different from the second application.
  • the document may be generated by a second application installed locally, or may be downloaded or shared locally by the second application, and then displayed by the first application.
  • the method includes: step S110, step S120, and step S130.
  • Step S110 Acquire a display request of the document.
  • the extension of the document file can include but is not limited to: txt, the document of the extension can be opened by word processing software or editor; doc, the document of the extension can be opened by the word processor application Microsoft Office Word developed by Microsoft Corporation , or through the office software WPS developed by Kingsoft Software Co., Ltd., etc.; hlp, the extension of the document can be opened by the Adobe adobe acrobat reader developed by the company; wps, the extension of the document can be passed through Kingsoft Software Limited
  • the office software WPS opened by the company is opened; rtf, the document of the extension can be opened by Microsoft Office Word, a word processor application developed by Microsoft Corporation, or opened by the office software WPS developed by Kingsoft Software Co., Ltd.; html,
  • the extension's document can be opened by various browsers; pdf, the extension's document can be opened by Adobe's application adobe acrobat reader and so on.
  • the manner of obtaining the presentation request of the document may include, but is not limited to, obtaining a double-click operation on the document, or obtaining an operation of displaying the interactive control of the document on the operation interface of the application, for example, displaying the interactive control may include “opening” the interaction. Controls or "open" interactive controls, etc.
  • Step S120 Parse the first attribute information of the element in the document according to the presentation request.
  • the document includes several elements, such as a picture, an audio, a video, and the like.
  • the element includes several attributes.
  • the first attribute information includes an attribute name and an attribute value. Taking a picture as an example, the attribute name may include but is not limited to a picture source (Source) and a picture. Transparency (Alpha) and locked (IsLocked), etc.; in the case of audio, it may include, but is not limited to, an audio source (url), a bit rate, and the like.
  • the image source indicates the source of the image, and may be a network link address or a local storage address of the image.
  • the audio source indicates the source of the audio, which can be a network link address or a local storage address of the audio.
  • Step S130 If the first attribute information is not obtained by the parsing, determining the display manner of the element according to the second attribute information of the element in the first application, where the second attribute information is the first The attribute definition information corresponding to the element to which the first attribute information belongs in the application.
  • the parsing does not obtain the first attribute information, including: receiving an identifier of an element attribute name and/or an attribute value, for example, receiving a “null” identifier; or receiving an element attribute name and/or an attribute value. For the wrong identifier, for example, the "error" identifier was received.
  • the corresponding element will display an error prompt, for example, the word "error" is displayed at the corresponding position of the element on the display screen. Wait.
  • the display manner of the element is determined according to the second attribute information of the element in the first application for displaying the document, the second attribute Information is the attribute definition information of the element, so that when the document cannot be completely parsed, the elements in the document can be displayed to the greatest extent, and the compatibility of the use of the document is improved.
  • the method for processing a document is displayed by the first application, and for the step S130 in the first embodiment, according to the second element in the first application.
  • the attribute information determining element is displayed by: searching for the attribute type corresponding to the same attribute name in the second attribute information according to the attribute name in the first attribute information; if the attribute type is a necessary attribute such as a data source, deleting the element; if the attribute type For non-essential attributes, the element is displayed based on the default attribute value.
  • the first application is different from the second application, and/or the first application is The version number of the second application is different.
  • the document may be generated by a second application installed locally, or may be downloaded or shared locally by the second application, and then displayed by the first application.
  • the processing method of the document of this embodiment includes the following steps: step S210, step S220, step S230, step S240, and step S250.
  • the step S220 is the same as the step S110 in the first embodiment;
  • the step S230 is the same as the step S120 in the first embodiment, and the same steps are not described again.
  • Step S210 Generate a document by using a second application, where the document carries first attribute information of the element, where the first attribute information includes an attribute name and an attribute value.
  • the first attribute information is formed in the process of generating the document by the second application.
  • the second application When the second application is installed in the system, the second application carries the attribute name and the attribute value range. In the process of generating the document, the first attribute information is included.
  • the attribute name is consistent with the attribute name carried in the second application, and the attribute value in the first attribute information is within the range of the attribute value carried by the second application, and is determined according to the editing result of the element by the user.
  • the three attributes of the image (element) in the document are image source, image transparency and lock, respectively, where the attribute value of the image source is File://..../1.png; the attribute of the image transparency The value is 0.5, the image transparency is 1 for opacity, the image transparency is 0 for transparency, the image transparency is 0.5 for semi-transparent; the locked property value is true, and the locked property value is false for unlocked, locked property value.
  • True means locked.
  • Step S220 Acquire a display request of the document.
  • the display request of the document is obtained by displaying the control; or, in the storage location of the document, the display request of the document is obtained by selecting the open mode, for example, the name stored in the C disk of the device is 1 Right-click on the .doc file to bring up the "Open With” method. Select the first application from the drop-down menu of Open Method, which is used to display the 1.doc documentation.
  • Step S230 Parse the first attribute information of the element in the document according to the presentation request.
  • Step S240 If the first attribute information of the element in the document is not obtained, the attribute type corresponding to the same attribute name in the second attribute information of the element in the first application is searched according to the attribute name in the first attribute information in the document;
  • the second attribute information includes an attribute name, an attribute type, an attribute value range, and a default attribute value. If the first attribute information is parsed, the display manner of the element is determined according to the first attribute information and the second attribute information.
  • the default attribute value corresponding to each attribute name is set in advance. Because different attributes affect the elements differently, some attributes are directly lost and the elements cannot be rendered. Some attributes will only cause style differences. Some attributes will cause behavior differences. Take the picture as an example. If the image source fails to parse, the image will not be rendered. When the transparency resolution fails, the transparency of the image will be incorrect (that is, the resolution of the failed image is different from the resolution of the successfully resolved image); Error, the behavior of the image being locked will be incorrect (ie, the difference between the parsing of the failed image and the parsing of the successful image is whether or not it is locked). In this embodiment, the attribute type is divided into a necessary attribute and a non-essential attribute.
  • the necessary attribute refers to the attribute type that the loss directly causes the element to be unable to render
  • the non-essential attribute refers to the attribute type that the loss does not cause the element to be rendered.
  • the default attribute values are respectively set to the non-essential attributes in the first application.
  • Determining, according to the first attribute information and the second attribute information, the manner in which the element is displayed includes: searching for the same attribute name in the second attribute information according to an attribute name in the first attribute information. Corresponding attribute value range; if the attribute value in the first attribute information is in the corresponding attribute value range in the second attribute information, the element is displayed according to the attribute value; if the first attribute information The attribute value in the attribute value is not in the corresponding attribute value range in the second attribute information, and the element is displayed according to the default attribute value.
  • Step S250 if the attribute type is a necessary attribute such as a data source, the element is deleted; if the attribute class The type is a non-essential attribute, and the element is displayed according to the default attribute value.
  • the attribute in the element When the attribute in the element is parsed, if the attribute type of the attribute is a necessary attribute such as a data source, the element is deleted. If the attribute type of the attribute is a non-essential attribute, the default of the attribute name of the attribute in the first application is corresponding. The attribute value is assigned as the result of the parsing to the attribute value in the attribute name in the first attribute information in the document, and the element is displayed according to the default attribute value.
  • the default attribute value is set in the second attribute information of the element in the first application, and when the first application is used to parse the document, if the first attribute of the element in the document is not parsed Information, the default attribute value is displayed as the parsing result, so that when the document can not be fully parsed, the elements in the document can be displayed to the greatest extent, and the compatibility of the document is improved.
  • the attribute value in the first attribute information exceeds the attribute value corresponding to the corresponding attribute name in the first application.
  • the default attribute value is also displayed as the parsing result, so that when the document cannot be completely parsed, the elements in the document can be displayed to the greatest extent, and the compatibility of the document is improved.
  • This embodiment is an application of the technical solutions of Embodiment 1 and Embodiment 2.
  • the elements in the document are taken as an example for illustration, and the principles of other elements are the same.
  • the attribute type is distinguished by the necessary attribute and the non-essential attribute, wherein the attribute type corresponding to the data source is a necessary attribute, and the attribute type corresponding to the other attribute is a non-essential attribute.
  • the attribute value range in the attribute information of the element of the application is omitted, that is, in the solution of the embodiment, the default is from the document.
  • the attribute values of the parsed elements are within the attribute values of the elements of the application used to display the document; the attribute values of the elements parsed from the document are not within the attribute values of the elements of the application used to display the document.
  • the elements in the document are displayed based on the default attribute values of the elements in the application.
  • the attribute information of the picture in the 1.0 version of the A software is shown in Table 1, wherein the picture element contains three attributes: a picture source (Source), an image transparency (Alpha), and a lock (IsLocked), wherein the picture source is a necessary attribute.
  • the default value is null, the image transparency is non-essential, the default value is 1; the lock is non-essential, and the default value is false (that is, unlocked).
  • Document B is created using version 1.0 of A software.
  • the attribute information of the picture in document B is shown in Table 2.
  • the picture element includes three attributes: image source, image transparency (Alpha), and lock (IsLocked).
  • the attribute value of the image source is "File://..../1.png”, the attribute value of the image transparency is "0.5”, and the value of the locked attribute is "true” (that is, locked, cannot be operated) ).
  • the attribute information of the picture is shown in Table 3.
  • the picture element The prime consists of five attributes: Source, Brightness, Contrast, Saturation, and IsLocked, where the image source is a required attribute, the default value is null, and the brightness is not necessary. Attribute, the default value is 0.5; the contrast is non-essential attribute, the default value is 0.5; the saturation is non-essential attribute, the default value is 0.5; the lock is non-essential attribute, the default value is false (ie, it is unlocked and can be operated).
  • Document C is created using version 2.0 of the A software.
  • the attribute information of the picture in the document C is as shown in Table 4.
  • the picture element includes five attributes: source, brightness, contrast, and Contrast. Saturation and locked (IsLocked), where the attribute value of the image source is "File://..../1.png", the attribute value of the brightness is "0.8", and the value of the attribute of the contrast is "0.8".
  • the value of the attribute of the saturation is "0.8”
  • the value of the attribute of the lock is "false” (that is, it is unlocked and can be operated).
  • the image attributes obtained after parsing are shown in Table 5.
  • the image attributes include the image source, image transparency, and lock.
  • the attribute value of the image source is the document.
  • the attribute value in C is "File://..../1.png”
  • the attribute value of the lock is the attribute value "false” in the document C
  • the attribute value of the picture transparency is the default attribute in the 1.0 version of the A software.
  • the value is "1".
  • the picture element includes five attributes: Source, Brightness, Contrast, Saturation and locked (IsLocked), where the attribute value of the image source is the attribute value "File://..../1.png" in the image B, and the attribute value of the brightness is the 2.0 version of the A software.
  • the default attribute value is "0.5"
  • the contrast attribute value is the default attribute value "0.5” in the 2.0 version of the A software
  • the saturation attribute value is the default attribute value "0.5” in the 2.0 version of the A software, locked.
  • the attribute value is the attribute value "true” in picture B.
  • FIG. 3 is a schematic structural diagram of a processing apparatus of a document according to Embodiment 4 of the present invention, which is used to execute a processing method of a document in Embodiments 1 to 3.
  • the apparatus includes a request acquisition unit 310, a parsing unit 320, and a display unit 330.
  • the request obtaining unit 310 is configured to obtain a display request of the document.
  • the parsing unit 320 is connected to the request obtaining unit, and configured to parse the first attribute information of the element in the document according to the presentation request.
  • the display unit 330 is connected to the parsing unit, and is configured to determine, according to the second attribute information of the element in the first application, the display manner of the element, if the parsing does not obtain the first attribute information, where
  • the second attribute information is attribute definition information corresponding to the element to which the first attribute information belongs in the first application.
  • the second attribute information of the element in the first application is determined according to the second attribute information of the element in the first application, so that the maximum degree can be solved when the document cannot be completely parsed. Showcase the elements in the document to improve the compatibility of the document.
  • the first attribute information includes an attribute name and an attribute value
  • the second attribute information includes an attribute name, an attribute type, an attribute value range, and a default attribute value
  • the parsing unit is specifically configured to receive an identifier whose element attribute name and/or attribute value is null, or receive an identifier that the element attribute name and/or the attribute value is wrong.
  • the display unit is specifically configured to check according to the attribute name in the first attribute information. Finding an attribute type corresponding to the same attribute name in the second attribute information; and deleting the element if the attribute type is a necessary attribute such as a data source; if the attribute type is a non-essential attribute, according to the The default attribute value shows the element.
  • the display unit is further configured to determine, according to the first attribute information and the second attribute information, a display manner of the element if the first attribute information is parsed.
  • the display unit is specifically configured to search, according to the attribute name in the first attribute information, a range of attribute values corresponding to the same attribute name in the second attribute information; and if the first attribute information is in the first attribute information If the attribute value is in the range of the attribute value corresponding to the second attribute information, the element is displayed according to the attribute value; if the attribute value in the first attribute information is not in the corresponding attribute in the second attribute information In the range of values, the element is presented according to the default attribute value.
  • the first attribute information is parsed, it is further determined whether the information is in the attribute value range of the same name attribute in the second attribute information, and in the range, the first attribute information is displayed, not in the range.
  • the range is displayed according to the default attribute value of the attribute of the same name in the second attribute information. This ensures that the displayed information must be within the range of attribute values set in the second attribute information, and different users can be personalized to meet the diverse requirements of the user.
  • the apparatus may further include: a generating unit, connected to the request obtaining unit, configured to generate the document by using a second application, where the document carries first attribute information of the element.
  • the first application is different from the second application, and/or the first application is different from the second application.
  • the processing device of the document provided by the embodiment of the present invention can be used to execute the processing method of the document provided by any embodiment of the present invention, and has the corresponding functions and beneficial effects of executing the method.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

一种文档的处理方法和装置,包括:获取文档的展示请求(S110);根据所述展示请求解析所述文档中元素的第一属性信息(S120);如果解析未得到所述第一属性信息,则根据第一应用程序中所述元素的第二属性信息确定所述元素的展示方式(S130),其中,所述第二属性信息是所述第一应用程序中所述第一属性信息所属元素对应的属性定义信息。该方法和装置针对解析未得到文档中元素的第一属性信息的情况,根据第一应用程序中元素的第二属性信息确定元素的展示方式,第二属性信息是所述元素的属性定义信息,这样,在无法完全解析文档时,也能最大程度地展示文档中的元素,提高文档使用的兼容性。

Description

文档的处理方法及装置 技术领域
本发明实施例涉及计算机应用技术领域,特别是涉及一种文档的处理方法及装置。
背景技术
电子文档是指以数据方式存于计算机中的文件,以下将电子文档简称为文档。文档中包括若干元素,例如图片、音频、视频等等,元素包括若干属性,以图片为例,可以包括如下属性:图片源和图片透明度等等。通常,软件(应用程序)在对文档进行操作时,需要对文档中的各元素的属性进行解析,然后,对解析后的元素执行相应的功能操作。当软件重装或者软件更新的时候,有可能会导致属性解析失败,进而导致元素无法展示,也无法再执行相应的功能操作。
发明内容
有鉴于此,本发明提出一种文档的处理方法及装置,提高文档使用的兼容性。
在第一方面,本发明实施例提供了一种文档的处理方法,包括:获取文档的展示请求;根据所述展示请求解析所述文档中元素的第一属性信息;如果解析未得到所述第一属性信息,则根据第一应用程序中所述元素的第二属性信息确定所述元素的展示方式,其中,所述第二属性信息是所述第一应用程序中所 述第一属性信息所属元素对应的属性定义信息。
在第二方面,本发明实施例提供了一种文档的处理装置,包括:请求获取单元,用于获取文档的展示请求;解析单元,与所述请求获取单元相连,用于根据所述展示请求解析所述文档中元素的第一属性信息;展示单元,与所述解析单元相连,用于如果解析未得到所述第一属性信息,则根据第一应用程序中所述元素的第二属性信息确定所述元素的展示方式,其中,所述第二属性信息是所述第一应用程序中所述第一属性信息所属元素对应的属性定义信息。
现有技术中,如果解析未得到文档中元素的第一属性信息,则在展示文档时,对应的元素将展示错误提示符,例如“error”字样等。采用本发明实施例的技术方案,如果未解析得到文档中元素的第一属性信息,则根据用于展示文档的第一应用程序中元素的第二属性信息确定元素的展示方式,第二属性信息是所述元素的属性定义信息,这样,在无法完全解析文档时,也能最大程度地展示文档中的元素,提高文档使用的兼容性。
附图说明
图1是本发明实施例一提供的文档的处理方法的流程图;
图2是本发明实施例二提供的文档的处理方法的流程图;
图3是本发明实施例四提供的文档的处理装置的结构示意图。
具体实施方式
下面结合附图和实施例对本发明作进一步的详细说明。可以理解的是,此处所描述的具体实施例仅仅用于解释本发明,而非对本发明的限定。还需要说 明的是,为了便于描述,附图中仅示出了与本发明相关的部分而非全部内容。另外还需要说明的是,为了便于说明,以下实施例中示出了与本发明相关的示例,这些示例仅作为说明本发明实施例的原理所用,并不作为对本发明实施例的限定,同时,这些示例的具体数值会根据不同的应用环境和装置或者组件的参数不同而不同。
本发明实施例提供的文档的处理方法及装置应用于客户端计算装置上。文档由各类应用程序生成、编辑,应用程序包括但不限于Microsoft Office(微软公司开发的基于Windows操作系统的办公软件套装)、Adobe Acrobat(是由Adobe公司开发的一款便携式文档格式((Portable Document Format,PDF)编辑软件)等,所述客户端计算装置可以是用于运行文档编辑类应用的个人电脑,也可以是用于运行文档编辑类应用的移动终端。其中,所述移动终端包括平板电脑、个人数字助理以及智能手机。
实施例一
图1是本发明实施例一提供的文档的处理方法的流程图,本实施例可适用于采用一种软件打开由另外一种软件制作的文档的情况,也可适用于采用一种版本的软件打开由相同软件的其他版本制作的文档的情况,该方法可以由文档的处理装置来执行,该装置可以由软件和/或硬件方式实现,该装置可以集成在任何可打开文档的设备中,例如典型的是用户终端设备,例如手机、电脑等。其中,第一应用程序与第二应用程序的类型不同,和/或,第一应用程序与第二应用程序的版本号不同。文档可以是由安装在本地的第二应用程序生成,也可以是由第二应用程序生成后下载或者共享到本地,进而由第一应用程序展示该文档。
该方法包括:步骤S110、步骤S120和步骤S130。
步骤S110、获取文档的展示请求。
文档文件的扩展名可以包括但不限于:txt,该扩展名的文档可以通过文字处理软件或编辑器打开;doc,该扩展名的文档可以通过微软公司开发的文字处理器应用程序Microsoft Office Word打开,或者通过金山软件股份有限公司研发的办公软件WPS打开等等;hlp,该扩展名的文档可以通过Adobe公司开发的应用程序adobe acrobat reader打开;wps,该扩展名的文档可以通过金山软件股份有限公司研发的办公软件WPS打开;rtf,该扩展名的文档可以通过微软公司开发的文字处理器应用程序Microsoft Office Word打开,或者通过金山软件股份有限公司研发的办公软件WPS打开等等;html,该扩展名的文档可以通过各种浏览器打开;pdf,该扩展名的文档可以通过Adobe公司开发的应用程序adobe acrobat reader打开等等。
获取文档的展示请求的方式可以包括但不限于:获取到对文档的双击操作,或者,在应用程序的操作界面上获取文档的展示交互控件的操作,例如,展示交互控件可以包括“打开”交互控件或者“open”交互控件等。
步骤S120、根据所述展示请求解析所述文档中元素的第一属性信息。
文档中包括若干元素,例如图片、音频、视频等等,元素包括若干属性,第一属性信息包括属性名称和属性值,以图片为例,属性名称可以包括但不限于图片源(Source)、图片透明度(Alpha)和锁定(IsLocked)等等;以音频为例,可以包括但不限于音频源(url)、比特率等等。其中,图片源表示图片的来源,可以是网络链接地址或者是图片在本地的存储地址等。音频源表示音频的来源,可以是网络链接地址或者是音频在本地的存储地址等。
步骤S130、如果解析未得到所述第一属性信息,则根据第一应用程序中所述元素的第二属性信息确定所述元素的展示方式,其中,所述第二属性信息是所述第一应用程序中所述第一属性信息所属元素对应的属性定义信息。
所述解析未得到所述第一属性信息包括:接收到元素属性名称和/或属性值为空的标识符,例如,接收到“null”标识符;或者接收到元素属性名称和/或属性值为错误的标识符,例如,接收到“error”标识符。
现有技术中,如果解析未得到文档中元素的第一属性信息,则在展示文档时,对应的元素将展示错误提示符,例如,在显示屏上该元素的对应位置处显示“error”字样等。采用本实施例的技术方案,如果未解析得到文档中元素的第一属性信息,则根据用于展示文档的第一应用程序中元素的第二属性信息确定元素的展示方式,所述第二属性信息是所述元素的属性定义信息,这样,在无法完全解析文档时,也能最大程度地展示文档中的元素,提高文档使用的兼容性。
实施例二
图2是本发明实施例二提供的文档的处理方法的流程图,文档的处理方法,通过第一应用程序展示文档,对于实施例一中的步骤S130,根据第一应用程序中元素的第二属性信息确定元素的展示方式包括:根据第一属性信息中的属性名称查找第二属性信息中相同的属性名称对应的属性类型;如果属性类型为数据源等必要属性,则删除元素;如果属性类型为非必要属性,则根据默认属性值展示元素。
其中,第一应用程序与第二应用程序的类型不同,和/或,第一应用程序与 第二应用程序的版本号不同。文档可以是由安装在本地的第二应用程序生成,也可以是由第二应用程序生成后下载或者共享到本地,进而由第一应用程序展示该文档。本实施例的文档的处理方法包括以下步骤:步骤S210、步骤S220、步骤S230、步骤S240和步骤S250。其中,步骤S220与实施例一中的步骤S110相同;步骤S230与实施例一中的步骤S120相同,相同的步骤不再赘述。
步骤S210、通过第二应用程序生成文档,文档中携带元素的第一属性信息,第一属性信息包括属性名称和属性值。
第一属性信息在第二应用程序生成文档的过程中形成,在系统安装第二应用程序时,第二应用程序中携带属性名称和属性值范围,在生成文档的过程中,第一属性信息中的属性名称与第二应用程序中携带的属性名称一致,第一属性信息中的属性值在第二应用程序携带的属性值范围内,并根据用户对元素的编辑结果确定。例如,文档中的图片(元素)的三个属性,属性名称分别为图片源、图片透明度和锁定,其中图片源的属性值为File://..../1.png;图片透明度的属性值为0.5,以图片透明度为1表示不透明,图片透明度为0表示透明,则图片的透明度为0.5表示半透明;锁定的属性值为true,锁定的属性值为false表示未锁定,锁定的属性值为true表示已锁定。
步骤S220、获取文档的展示请求。
在第一应用程序的编辑界面中,通过展示控件获取文档的展示请求;或者,在文档的存储位置,通过打开方式的选择获取文档的展示请求,例如,在设备的C盘存储的名称为1.doc的文档上点击右键,弹出“打开方式”,从打开方式的下拉菜单中选择第一应用程序,该第一应用程序用于展示1.doc的文档。
步骤S230、根据展示请求解析文档中元素的第一属性信息。
步骤S240、如果解析未得到文档中元素的第一属性信息,则根据文档中第一属性信息中的属性名称查找第一应用程序中元素的第二属性信息中相同的属性名称对应的属性类型;第二属性信息包括属性名称、属性类型、属性值范围和默认属性值。如果解析得到所述第一属性信息,则根据所述第一属性信息和所述第二属性信息确定所述元素的展示方式。
本发明实施例,在第一应用程序中,预先设置每个属性名称所对应的默认属性值。由于不同属性对元素的影响程度不同,有些属性丢失直接造成元素无法渲染,有些属性丢失只会造成样式差异,有些属性丢失会造成行为差异。以图片为例,如果图片源解析失败,图片将无法渲染;当透明度解析失败,图片的透明度将不正确(即解析失败的图片与解析成功的图片存在着透明度的样式区别);当锁定信息解析错误,图片被锁定的行为将不正确(即解析失败的图片与解析成功的图片存在着是否锁定的行为上的区别)。本实施例将属性类型分为必要属性和非必要属性,必要属性指丢失会直接导致元素无法渲染的属性类型,非必要属性指丢失不会导致元素无法渲染的属性类型。本实施例在第一应用程序中分别给非必要属性设置默认属性值。
其中,所述根据所述第一属性信息和所述第二属性信息确定所述元素的展示方式包括:根据所述第一属性信息中的属性名称查找所述第二属性信息中相同的属性名称对应的属性值范围;如果所述第一属性信息中的属性值在所述第二属性信息中对应的属性值范围中,则根据所述属性值展示所述元素;如果所述第一属性信息中的属性值不在所述第二属性信息中对应的属性值范围中,则根据所述默认属性值展示所述元素。
步骤S250、如果属性类型为数据源等必要属性,则删除元素;如果属性类 型为非必要属性,则根据默认属性值展示元素。
解析元素中的属性出错时,若属性的属性类型为数据源等必要属性,则将元素删除,若属性的属性类型为非必要属性,则将第一应用程序中该属性的属性名称对应的默认属性值作为解析结果赋值给文档中第一属性信息中属性名称中的属性值,并根据该默认属性值展示元素。
采用本实施例的技术方案,预先在第一应用程序中元素的第二属性信息中设置默认属性值,在采用第一应用程序对文档进行解析时,如果未解析得到文档中元素的第一属性信息,则将默认属性值作为解析结果进行展示,这样,在无法完全解析文档时,也能最大程度地展示文档中的元素,提高文档使用的兼容性。
进一步的,在采用第一应用程序对文档进行解析时,如果解析得到文档中元素的第一属性信息,针对第一属性信息中的属性值超过第一应用程序中对应的属性名称对应的属性值范围时,也将默认属性值作为解析结果进行展示,这样,在无法完全解析文档时,也能最大程度地展示文档中的元素,提高文档使用的兼容性。
实施例三
本实施例是实施例一和实施例二的技术方案的应用。在本实施例中,以文档中的元素为图片为例进行说明,其他元素的原理相同。为了便于操作,采用必要属性和非必要属性对属性类型进行区分,其中数据源对应的属性类型为必要属性,其他属性对应的属性类型为非必要属性。本实施例中,省略了应用程序的元素的属性信息中的属性值范围,即在本实施例的方案中,默认从文档中 解析得到的元素的属性值都在用于展示文档的应用程序的元素的属性值范围内;对于从文档中解析得到的元素的属性值不在用于展示文档的应用程序的元素的属性值范围内的情况,根据应用程序中的元素的默认属性值展示文档中的元素。
A软件的1.0版本中的图片的属性信息如表1所示,其中,图片元素包含三个属性:图片源(Source)、图片透明度(Alpha)和锁定(IsLocked),其中,图片源为必要属性,其默认值为空,图片透明度为非必要属性,默认值为1;锁定为非必要属性,默认值为false(即未锁定)。
属性 说明 类别 默认值
Source 图片源 必要属性  
Alpha 图片透明度 非必要属性 1
IsLocked 是否锁定 非必要属性 false
表1A软件的1.0版本中的图片的属性信息列表
使用A软件的1.0版本制作了文档B,文档B中的图片的属性信息如表2所示,其中,图片元素包括三个属性:图片源(Source)、图片透明度(Alpha)和锁定(IsLocked),其中的图片源的属性值为“File://..../1.png”,图片透明度的属性值为“0.5”,锁定的属性值为“true”(即已锁定,无法进行操作)。
Source File://..../1.png
Alpha 0.5
IsLocked True
表2文档B中的图片的属性信息列表
A软件升级到2.0版本时,其中图片的属性信息如表3所示,其中,图片元 素包括五个属性:图片源(Source)、亮度(Brightness)、对比度(Contrast)、饱和度(Saturation)和锁定(IsLocked),其中,图片源为必要属性,默认值为空;亮度为非必要属性,默认值为0.5;对比度为非必要属性,默认值为0.5;饱和度为非必要属性,默认值为0.5;锁定为非必要属性,默认值为false(即未锁定,可以进行操作)。
属性 说明 类别 默认值
Source 图片源 必要属性 -
Brightness 亮度 非必要属性 0.5
Contrast 对比度 非必要属性 0.5
Saturation 饱和度 非必要属性 0.5
IsLocked 是否锁定 非必要属性 false
表3A软件的2.0版本中的图片的属性信息列表
使用A软件的2.0版本制作了文档C,文档C中的图片的属性信息如表4所示,其中,图片元素包括五个属性:图片源(Source)、亮度(Brightness)、对比度(Contrast)、饱和度(Saturation)和锁定(IsLocked),其中的图片源的属性值为“File://..../1.png”,亮度的属性值为“0.8”,对比度的属性值为“0.8”,饱和度的属性值为“0.8”,锁定的属性值为“false”(即未锁定,可以进行操作)。
Source File://..../1.png
Brightness 0.8
Contrast 0.8
Saturation 0.8
IsLocked false
表4文档C中的图片的属性信息列表
使用A软件的1.0版本打开A软件的2.0版本生成的文档C,解析后最终得到的图片属性如表5所示,图片属性包括图片源、图片透明度和锁定,其中的图片源的属性值为文档C中的属性值“File://..../1.png”,锁定的属性值为文档C中的属性值“false”,图片透明度的属性值为A软件的1.0版本中的默认属性值“1”。
Source File://..../1.png
Alpha 1
IsLocked false
表5A软件的1.0版本打开的文档C中的图片的属性信息列表
使用A软件的2.0版本打开A软件的1.0版本生成的文档B,最终的图片属性如表6所示,图片元素包括五个属性:图片源(Source)、亮度(Brightness)、对比度(Contrast)、饱和度(Saturation)和锁定(IsLocked),其中的图片源的属性值为图片B中的属性值“File://..../1.png”,亮度的属性值为A软件的2.0版本中的默认属性值“0.5”,对比度的属性值为A软件的2.0版本中的默认属性值“0.5”,饱和度的属性值为A软件的2.0版本中的默认属性值“0.5”,锁定的属性值为图片B中的属性值“true”。
Source File://..../1.png
Brightness 0.5
Contrast 0.5
Saturation 0.5
IsLocked true
表6A软件的2.0版本打开的文档B中的图片的属性信息列表
实施例四
图3是本发明实施例四提供的文档的处理装置的结构示意图,该装置用于执行实施例一至三中的文档的处理方法。该装置包括:请求获取单元310、解析单元320和展示单元330。
请求获取单元310,用于获取文档的展示请求。
解析单元320,与所述请求获取单元相连,用于根据所述展示请求解析所述文档中元素的第一属性信息。
展示单元330,与所述解析单元相连,用于如果解析未得到所述第一属性信息,则根据第一应用程序中所述元素的第二属性信息确定所述元素的展示方式,其中,所述第二属性信息是所述第一应用程序中所述第一属性信息所属元素对应的属性定义信息。
本发明实施例针对解析未得到文档中元素的第一属性信息的情况,根据第一应用程序中元素的第二属性信息确定元素的展示方式,这样,在无法完全解析文档时,也能最大程度地展示文档中的元素,提高文档使用的兼容性。
更具体的,所述第一属性信息包括属性名称和属性值,所述第二属性信息包括属性名称、属性类型、属性值范围和默认属性值。
更具体的,所述解析单元具体用于接收到元素属性名称和/或属性值为空的标识符,或者接收到元素属性名称和/或属性值为错误的标识符。
更具体的,所述展示单元具体用于根据所述第一属性信息中的属性名称查 找所述第二属性信息中相同的属性名称对应的属性类型;并且,如果所述属性类型为数据源等必要属性,则删除所述元素;如果所述属性类型为非必要属性,则根据所述默认属性值展示所述元素。
更具体的,所述展示单元还用于如果解析得到所述第一属性信息,则根据所述第一属性信息和所述第二属性信息确定所述元素的展示方式。
更具体的,所述展示单元具体用于根据所述第一属性信息中的属性名称查找所述第二属性信息中相同的属性名称对应的属性值范围;并且如果所述第一属性信息中的属性值在所述第二属性信息中对应的属性值范围中,则根据所述属性值展示所述元素;如果所述第一属性信息中的属性值不在所述第二属性信息中对应的属性值范围中,则根据所述默认属性值展示所述元素。
在本实施例中,在解析得到所述第一属性信息后,还判断该信息是否在第二属性信息中同名属性的属性值范围中,在该范围中则依第一属性信息进行展示,不在该范围中则依第二属性信息中同名属性的默认属性值进行展示。这样就确保展示的信息一定在第二属性信息中设置的属性值范围内,不同的用户可以进行个性化的设置,满足用户多样化的要求。
更具体的,该装置还可以包括:生成单元,与所述请求获取单元相连,用于通过第二应用程序生成所述文档,所述文档中携带所述元素的第一属性信息。
更具体的,所述第一应用程序与所述第二应用程序的类型不同,和/或,所述第一应用程序与所述第二应用程序的版本号不同。
本发明实施例所提供的文档的处理装置可用于执行本发明任意实施例所提供的文档的处理方法,具备执行该方法相应的功能和有益效果。
注意,上述仅为本发明的较佳实施例及所运用技术原理。本领域技术人员 会理解,本发明不限于这里所述的特定实施例,对本领域技术人员来说能够进行各种明显的变化、重新调整和替代而不会脱离本发明的保护范围。因此,虽然通过以上实施例对本发明进行了较为详细的说明,但是本发明不仅仅限于以上实施例,在不脱离本发明构思的情况下,还可以包括更多其他等效实施例,而本发明的范围由所附的权利要求范围决定。

Claims (12)

  1. 一种文档的处理方法,其特征在于,包括:
    获取文档的展示请求;
    根据所述展示请求解析所述文档中元素的第一属性信息;
    如果解析未得到所述第一属性信息,则根据第一应用程序中所述元素的第二属性信息确定所述元素的展示方式,其中,所述第二属性信息是所述第一应用程序中所述第一属性信息所属元素对应的属性定义信息。
  2. 根据权利要求1所述的文档的处理方法,其特征在于,所述第一属性信息包括属性名称和属性值,所述第二属性信息包括属性名称、属性类型、属性值范围和默认属性值。
  3. 根据权利要求2所述的文档的处理方法,其特征在于,所述解析未得到所述第一属性信息包括:
    接收到元素属性名称和/或属性值为空的标识符,或者接收到元素属性名称和/或属性值为错误的标识符。
  4. 根据权利要求3所述的文档的处理方法,其特征在于,所述根据第一应用程序中所述元素的第二属性信息确定所述元素的展示方式包括:
    根据所述第一属性信息中的属性名称查找所述第二属性信息中相同的属性名称对应的属性类型;
    如果所述属性类型为必要属性,则删除所述元素;如果所述属性类型为非必要属性,则根据所述默认属性值展示所述元素。
  5. 根据权利要求2所述的文档的处理方法,其特征在于,还包括:
    如果解析得到所述第一属性信息,则根据所述第一属性信息和所述第二属性信息确定所述元素的展示方式。
  6. 根据权利要求5所述的文档的处理方法,其特征在于,所述根据所述第一属性信息和所述第二属性信息确定所述元素的展示方式包括:
    根据所述第一属性信息中的属性名称查找所述第二属性信息中相同的属性名称对应的属性值范围;
    如果所述第一属性信息中的属性值在所述第二属性信息中对应的属性值范围中,则根据所述属性值展示所述元素;如果所述第一属性信息中的属性值不在所述第二属性信息中对应的属性值范围中,则根据所述默认属性值展示所述元素。
  7. 一种文档的处理装置,其特征在于,包括:
    请求获取单元,用于获取文档的展示请求;
    解析单元,与所述请求获取单元相连,用于根据所述展示请求解析所述文档中元素的第一属性信息;
    展示单元,与所述解析单元相连,用于如果解析未得到所述第一属性信息,则根据第一应用程序中所述元素的第二属性信息确定所述元素的展示方式,其中,所述第二属性信息是所述第一应用程序中所述第一属性信息所属元素对应的属性定义信息。
  8. 根据权利要求7所述的文档的处理装置,其特征在于,所述第一属性信息包括属性名称和属性值,所述第二属性信息包括属性名称、属性类型、属性值范围和默认属性值。
  9. 根据权利要求8所述的文档的处理装置,其特征在于,所述解析单元具体用于接收到元素属性名称和/或属性值为空的标识符,或者接收到元素属性名称和/或属性值为错误的标识符。
  10. 根据权利要求9所述的文档的处理装置,其特征在于,所述展示单元具体用于根据所述第一属性信息中的属性名称查找所述第二属性信息中相同的属性名称对应的属性类型;并且,如果所述属性类型为必要属性,则删除所述元素;如果所述属性类型为非必要属性,则根据所述默认属性值展示所述元素。
  11. 根据权利要求8所述的文档的处理装置,其特征在于,所述展示单元还用于如果解析得到所述第一属性信息,则根据所述第一属性信息和所述第二属性信息确定所述元素的展示方式。
  12. 根据权利要求11所述的文档的处理装置,其特征在于,所述展示单元具体用于根据所述第一属性信息中的属性名称查找所述第二属性信息中相同的属性名称对应的属性值范围;并且如果所述第一属性信息中的属性值在所述第二属性信息中对应的属性值范围中,则根据所述属性值展示所述元素;如果所述第一属性信息中的属性值不在所述第二属性信息中对应的属性值范围中,则根据所述默认属性值展示所述元素。
PCT/CN2016/113398 2016-08-31 2016-12-30 文档的处理方法及装置 WO2018040439A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201610795938.6 2016-08-31
CN201610795938.6A CN106227713B (zh) 2016-08-31 2016-08-31 文档的处理方法及装置

Publications (1)

Publication Number Publication Date
WO2018040439A1 true WO2018040439A1 (zh) 2018-03-08

Family

ID=58075293

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/113398 WO2018040439A1 (zh) 2016-08-31 2016-12-30 文档的处理方法及装置

Country Status (2)

Country Link
CN (1) CN106227713B (zh)
WO (1) WO2018040439A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114218441A (zh) * 2021-11-22 2022-03-22 慧之安信息技术股份有限公司 对uof文档进行调用和展示的方法

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106227713B (zh) * 2016-08-31 2018-11-06 广州视睿电子科技有限公司 文档的处理方法及装置

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2000075784A1 (en) * 1999-06-03 2000-12-14 Sycamore Networks, Inc. Software translation using metadata
US6298353B1 (en) * 1998-11-19 2001-10-02 International Business Machines Corporation Checking serialization compatibility between versions of java classes
CN101165682A (zh) * 2006-10-20 2008-04-23 北京北大方正电子有限公司 一种文档文件的处理方法及系统
CN101685394A (zh) * 2008-09-26 2010-03-31 国际商业机器公司 用于提供版本间文档兼容性的方法和装置
CN101937426A (zh) * 2010-08-31 2011-01-05 北京红旗贰仟软件技术有限公司 一种不兼容数据的处理方法和装置
CN106227713A (zh) * 2016-08-31 2016-12-14 广州视睿电子科技有限公司 文档的处理方法及装置

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6298353B1 (en) * 1998-11-19 2001-10-02 International Business Machines Corporation Checking serialization compatibility between versions of java classes
WO2000075784A1 (en) * 1999-06-03 2000-12-14 Sycamore Networks, Inc. Software translation using metadata
CN101165682A (zh) * 2006-10-20 2008-04-23 北京北大方正电子有限公司 一种文档文件的处理方法及系统
CN101685394A (zh) * 2008-09-26 2010-03-31 国际商业机器公司 用于提供版本间文档兼容性的方法和装置
CN101937426A (zh) * 2010-08-31 2011-01-05 北京红旗贰仟软件技术有限公司 一种不兼容数据的处理方法和装置
CN106227713A (zh) * 2016-08-31 2016-12-14 广州视睿电子科技有限公司 文档的处理方法及装置

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114218441A (zh) * 2021-11-22 2022-03-22 慧之安信息技术股份有限公司 对uof文档进行调用和展示的方法

Also Published As

Publication number Publication date
CN106227713A (zh) 2016-12-14
CN106227713B (zh) 2018-11-06

Similar Documents

Publication Publication Date Title
US20220247833A1 (en) Installable web applications
US10956652B2 (en) Support for non-native file types in web application environment
US8601438B2 (en) Data transformation based on a technical design document
US9948700B2 (en) ADFDI support for custom attribute properties
CN107402696B (zh) 使用动作注册表跨用户和设备编辑数据
US8543973B2 (en) Method and system for providing authentication schemes for web services
US9967370B2 (en) OData enabled mobile software applications
US7774195B2 (en) Method and system for creating, storing, managing and consuming culture specific data
US9880989B1 (en) Document annotation service
US8904012B2 (en) Client-server input method editor architecture
US9736143B2 (en) Customized log-in experience
US20130054812A1 (en) System and method for dynamically assembling an application on a client device
US9953018B2 (en) Transfer of content between documents of different storage types
US20100083102A1 (en) Online Content Editing of Dynamic Websites
US20150193832A1 (en) Method, apparatus, and system for communicating and presenting product information
KR20120049291A (ko) 동적인 미디어 콘텐츠 미리 보기
US20140188929A1 (en) Computer-readable storage medium, file management apparatus, and file management method
WO2018040439A1 (zh) 文档的处理方法及装置
US20140188950A1 (en) Computer-readable storage medium, file management apparatus, and file management method
JP2017507388A (ja) 文書及びオブジェクトの操作
KR101965722B1 (ko) 단독 편집 및 동시 편집인지에 따라 웹 문서에 대한 편집 신뢰성을 보장하는 장치 및 이의 동작 방법
US20240256765A1 (en) Custom formulas in office cloud platform add-in
US8856065B2 (en) Information processing apparatus, document access method, and computer program
US8935343B2 (en) Instant messaging network resource validation
US20240296166A1 (en) Deep Connectivity Between Disparate Database Systems

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: 16914999

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205N DATED 08/05/2019)

122 Ep: pct application non-entry in european phase

Ref document number: 16914999

Country of ref document: EP

Kind code of ref document: A1