CN104216868A - Adaptation method and device for document display format - Google Patents

Adaptation method and device for document display format Download PDF

Info

Publication number
CN104216868A
CN104216868A CN201410457408.1A CN201410457408A CN104216868A CN 104216868 A CN104216868 A CN 104216868A CN 201410457408 A CN201410457408 A CN 201410457408A CN 104216868 A CN104216868 A CN 104216868A
Authority
CN
China
Prior art keywords
information
terminal device
character string
text message
formatted file
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.)
Granted
Application number
CN201410457408.1A
Other languages
Chinese (zh)
Other versions
CN104216868B (en
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.)
Wuhan Iron and Steel Group Corp
Original Assignee
Wuhan Iron and Steel Group Corp
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 Wuhan Iron and Steel Group Corp filed Critical Wuhan Iron and Steel Group Corp
Priority to CN201410457408.1A priority Critical patent/CN104216868B/en
Publication of CN104216868A publication Critical patent/CN104216868A/en
Application granted granted Critical
Publication of CN104216868B publication Critical patent/CN104216868B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The invention discloses an adaptation method and device for a document display format. The method is applied to terminal equipment and comprises the following steps: reading a formatted document; analyzing the formatted document; acquiring first positional information of first text information and second positional information of picture information when the formatted document comprises the first text information and the picture information; acquiring a display specification of terminal equipment and determining first adjustment proportion information of the first positional information and the second positional information according to the display specification of the terminal equipment; determining third positional information of the first text information on the terminal equipment according to the first adjustment proportion information; determining fourth positional information of the picture information on the terminal equipment according to the first adjustment proportion information; determining the display mode of the first text information and the picture information on the terminal equipment according to the third positional information and the fourth positional information.

Description

A kind of adaptation method of document display format and device
Technical field
The present invention relates to the technical field of information display in Mobile solution research and development, particularly relate to a kind of adaptation method and device of document display format.
Background technology
In Mobile solution research and development, it is the primary demand of user that document can be presented in terminal presentation facility quick, correct and attractive in appearancely, but user is used for the specification of the terminal presentation facility showing document is not quite similar; So, when document is pushed to terminal from service end, the adaptation of document format must be carried out according to the specification of terminal presentation facility; Further, also need if desired on the basis of first time adaptation, to carry out secondary adaptation to document format according to the special demands of user.
But present inventor is in the process realizing invention technical scheme in the embodiment of the present application, find that above-mentioned technology at least exists following technical matters:
The first, developer is generally by writing document format adaptation method voluntarily according to user's request.But this method expends huge, has a strong impact on development efficiency.
The second, user utilizes the adaptive tool of paying to carry out adaptation to document display format.But this method is only applicable to the situation of single adaptation, secondary or repeatedly adaptive cannot be carried out according to the special demands of user to document.
Therefore, the problem needing solution at present badly is: how to carry out adaptation to the display format of document simply and effectively.
Summary of the invention
For prior art Problems existing, embodiments provide a kind of adaptation method and device of document display format.
The embodiment of the present invention provides a kind of adaptation method of document display format, and described method is applied to terminal device, and described method comprises:
Reading format file;
Resolve described formatted file, when described formatted file comprises the first text message and pictorial information, obtain the primary importance information of described first text message and the second place information of described pictorial information;
Obtain the display specification of described terminal device, determine the first resize ratio information of described primary importance information and described second place information according to the display specification of described terminal device;
Three positional information of described first text message on described terminal device is determined according to described first resize ratio information;
Four positional information of described pictorial information on described terminal device is determined according to described first resize ratio information;
Described first text message and the display mode of described pictorial information on described terminal device is determined according to described 3rd positional information and described 4th positional information.
In such scheme, described reading format file comprises:
The filename of formatted file is obtained according to the formatted file path of input;
According to formatted file form differentiating method, character string parsing is carried out to the filename got, obtain the extension name of described formatted file;
Corresponding file reading is called, reading format file according to the formatted file extension name got.
Resolve described formatted file described in such scheme, when described formatted file comprises the first text message and pictorial information, obtain the primary importance information of described first text message and the second place information of described pictorial information, specifically comprise:
According to formatted file resolution rules, described formatted file is resolved to the first formatted file character string;
Be separated the first character string representing the first text message in described first formatted file character string and the second character string representing pictorial information;
Obtain the primary importance information of described first character string in described first formatted file character string and the second place information of described second character string in described first formatted file character string.
In such scheme, after determining described first text message and the display mode of described pictorial information on described terminal device according to described 3rd positional information and described 4th positional information, described method also comprises:
When getting the second text message, redefine the second resize ratio information of described primary importance information and described second place information according to the display specification of terminal device and described second Textual information;
Five positional information of described second text message on described terminal device is determined according to described second resize ratio information;
Six positional information of described pictorial information on described terminal device is determined according to described second resize ratio information;
Described second text message and the display mode of described pictorial information on described terminal device is determined according to described 5th positional information and described 6th positional information.
In such scheme, when described formatted file comprises the first text message, described method also comprises:
Obtain the 7th positional information of described first text message;
Obtain the display specification of described terminal device, determine the 3rd resize ratio information of described 7th positional information according to the display specification of described terminal device;
Described first text message the 7th positional information is on the terminal device determined according to described 3rd resize ratio information;
The display mode of described first text message on described terminal device is determined according to described 7th positional information.
Present invention also offers a kind of adaptive device of document display format, described device comprises:
Reading unit, described reading unit is used for reading format file;
Resolution unit, the formatted file that described resolution unit reads for resolving described reading unit, when described formatted file comprises the first text message and pictorial information, obtain the primary importance information of described first text message and the second place information of described pictorial information;
Determining unit, described determining unit, for obtaining the display specification of described terminal device, determines the first resize ratio information of described primary importance information and described second place information according to the display specification of described terminal device;
Three positional information of described first text message on described terminal device is determined according to described first resize ratio information;
Four positional information of described pictorial information on described terminal device is determined according to described first resize ratio information;
Described first text message and the display mode of described pictorial information on described terminal device is determined according to described 3rd positional information and described 4th positional information.
In such scheme, described reading unit comprises:
First reading unit, described first reading unit is used for the filename obtaining formatted file according to the formatted file path of input;
Second reading unit, described second reading unit is used for carrying out character string parsing according to formatted file form differentiating method to the filename that described first reading unit gets, and obtains the extension name of described formatted file;
Third reading gets unit, and described third reading is got unit and called corresponding file reading for the formatted file extension name got according to described second reading unit, reading format file.
In such scheme, described resolution unit comprises:
First resolution unit, described first resolution unit is used for according to formatted file resolution rules, described formatted file is resolved to the first formatted file character string;
Second resolution unit, described second resolution unit is for separating of representing the first character string of the first text message in described first formatted file character string and representing the second character string of pictorial information;
3rd resolution unit, described 3rd resolution unit is for obtaining the primary importance information of described first character string in described first formatted file character string and the second place information of described second character string in described first formatted file character string.
In such scheme, after determining described first text message and the display mode of described pictorial information on described terminal device according to described 3rd positional information and described 4th positional information, described determining unit also for:
When getting the second text message, redefine the second resize ratio information of described primary importance information and described second place information according to the display specification of terminal device and described second Textual information;
Five positional information of described second text message on described terminal device is determined according to described second resize ratio information;
Six positional information of described pictorial information on described terminal device is determined according to described second resize ratio information;
Described second text message and the display mode of described pictorial information on described terminal device is determined according to described 5th positional information and described 6th positional information.
In such scheme, when described formatted file comprises the first text message, described determining unit also for:
Obtain the 7th positional information of described first text message;
Obtain the display specification of described terminal device, determine the 3rd resize ratio information of described 7th positional information according to the display specification of described terminal device;
Described first text message the 7th positional information is on the terminal device determined according to described 3rd resize ratio information;
The display mode of described first text message on described terminal device is determined according to described 7th positional information.
The adaptation method of the document display format that the embodiment of the present invention provides, described method is applied to terminal device, and described method comprises: reading format file; Resolve described formatted file, when described formatted file comprises the first text message and pictorial information, obtain the primary importance information of described first text message and the second place information of described pictorial information; Obtain the display specification of described terminal device, determine the first resize ratio information of described primary importance information and described second place information according to the display specification of described terminal device; Three positional information of described first text message on described terminal device is determined according to described first resize ratio information; Four positional information of described pictorial information on described terminal device is determined according to described first resize ratio information; Described first text message and the display mode of described pictorial information on described terminal device is determined according to described 3rd positional information and described 4th positional information.So, can the terminal presentation facility of automatic adaptation different size simply and effectively, improve the efficiency of document display format adaptation.
Accompanying drawing explanation
The adaptation method schematic flow sheet of the document display format that Fig. 1 provides for the embodiment of the present invention one;
The adaptive device structural representation of the document display format that Fig. 2 provides for the embodiment of the present invention two;
The structural representation of the reading unit that Fig. 3 provides for the embodiment of the present invention two;
The structural representation of the resolution unit that Fig. 4 provides for the embodiment of the present invention two.
Embodiment
In order to content of the present invention can be understood better, first introduce in prior art the method solving document fit herein, at present, solve document fit and mainly comprise two kinds of methods:
The first, developer writes document format adaptation method in service end voluntarily according to user's request.Although this method can well solve the adaptation issues of document display, expend huge, have a strong impact on development efficiency.
The second, utilize the adaptive tool of paying to carry out adaptation to document display format.But this method is only applicable to the situation of single adaptation, secondary or repeatedly adaptive cannot be carried out according to the special demands of user to document.In this case, if carry out secondary adaptation secondary development must be carried out, again write adaptation method, and the exploitation of the Mobile solution of main flow must take into account Android operation system and IOS (Iphone Operation System) operating system, R&D intensity is large, and application efficiency is low.
As can be seen from the above description, the adaptation method of above-mentioned two kinds of document display formats can not meet the actual demand of user, and is becoming the obstacle of application and development.
Based on this, embodiments provide a kind of Java adaptation method of document display format, the Java adaptation method of described document display format is developed based on Java language, can directly call in the development platform of Android, call by axis2 skeleton in IOS development platform, improve application and development efficiency.
Particularly, in various embodiments of the present invention: reading format file; Resolve described formatted file, when described formatted file comprises the first text message and pictorial information, obtain the primary importance information of described first text message and the second place information of described pictorial information; Obtain the display specification of described terminal device, determine the first resize ratio information of described primary importance information and described second place information according to the display specification of described terminal device; Three positional information of described first text message on described terminal device is determined according to described first resize ratio information; Four positional information of described pictorial information on described terminal device is determined according to described first resize ratio information; Described first text message and the display mode of described pictorial information on described terminal device is determined according to described 3rd positional information and described 4th positional information.
Below by drawings and the specific embodiments, technical scheme of the present invention is described in further detail.
Embodiment one
The embodiment of the present invention provides a kind of adaptation method of document display format, and as shown in Figure 1, described method mainly comprises the following steps:
Step 110, reading format file;
In this step, service end utilizes formatted file read method, obtains the filename of formatted file according to the formatted file path of input; According to formatted file form differentiating method, character string parsing is carried out to the filename got, obtain the extension name of described formatted file; Corresponding formatted file read method is called, reading format file according to the formatted file extension name got.
Wherein, the kind of described formatted file form can comprise: the PowerPoint file layout (.pptx) etc. of the Excel file form (.xlsx) of the word document form (.docx) of text-only file form (.txt), below Office2007 version word document form (.doc), more than Office2007 version, the Excel file form (.xls) of below Office2007 version, more than Office2007 version, Portable document form (PDF, Portable Document Format), more than Office2007 version.
Step 111, resolves described formatted file, when described formatted file comprises the first text message and pictorial information, obtains the primary importance information of described first text message and the second place information of described pictorial information;
In this step, service end according to formatted file resolution rules, to described formatted file one by one character resolve, obtain the first formatted file character string; Judge whether comprise pictorial information in described first formatted file character string, when determining that described first formatted file character string comprises pictorial information, be separated the first character string representing the first text message in described first formatted file character string and the second character string representing pictorial information; Mark the primary importance information of described first character string in described first formatted file character string and the second place information of described second character string in described first formatted file character string, to obtain primary importance information and second place information.
Particularly, because the formatted file of different-format has different character string characteristics, so the first character string and the second character string can be separated in the first formatted file character string according to character string characteristic; And mark in described first character string and obtain the start-stop position and string length that represent text formatting, text text, each self-corresponding character string of text header; Mark in described second character string and obtain the start-stop position and string length that represent picture format, image content, each self-corresponding character string of picture header.Wherein, described primary importance information comprises: the starting position of described first character string in the first formatted file character string and end position; Described second place information comprises: the starting position of the second character string in the first formatted file character string and end position.
Here, service end utilizes setPicturesManager () method the second character string to be separated, and utilizes SavePicture () method to preserve the second character string separated.Wherein, the content in described second character string can comprise: the kind of picture, content, title, width, highly, sharpness etc.
In addition, also need the caption position in the character string of location first and text segment dropping place to put, and row division is dropped into the text segment of described text-only file.
Here, after described first character is separated with described second character string by described service end, also to resolve described pictorial information and be inserted into inserted mode in described first text message, can correctly show described text message and described pictorial information in terminal presentation facility; Wherein,
Described inserted mode comprises following several: described first text message is around described pictorial information; Described pictorial information floats on above described first text message; Described pictorial information to be lining in below described first text message etc.
Step 112, obtains the display specification of described terminal device, determines the first resize ratio information of described primary importance information and described second place information according to the display specification of described terminal device; Three positional information of described first text message on described terminal device is determined according to described first resize ratio information; Four positional information of described pictorial information on described terminal device is determined according to described first resize ratio information;
In this step, after service end utilizes window manager WindowManager to obtain the display specification of terminal device; Determine the first resize ratio information of described primary importance information and described second place information according to the display specification of the terminal device obtained, determine three positional information of described first text message on described terminal device according to described first resize ratio information; Four positional information of described pictorial information on described terminal device is determined according to described first resize ratio information.Wherein, the display specification of described terminal device comprises: the size, sharpness etc. of terminal device.
Step 113, determines described first text message and the display mode of described pictorial information on described terminal device according to described 3rd positional information and described 4th positional information.
In this step, after service end determines described first text message and described pictorial information display mode on the terminal device according to described 3rd positional information and described 4th positional information, according to html file conversion method, first described first character string being converted to can by the file of terminal device coupling display, and the string that the character string that the text formatting after conversion is corresponding is placed in the first formatted file character string is first; According to the first text display form after conversion, suitability amendment is carried out to described second character string again, according to the 3rd positional information and the 4th positional information, amended second character string is inserted in the first character string, complete adapting operation, with the specification making the format of adaptive amended formatted file can mate display device, the format of described formatted file covers original form.
In addition, when amended second character string is inserted in the first character string according to the 3rd positional information and the 4th positional information by described service end, after completing adapting operation, also need according to the further adaptive described pictorial information of described inserted mode and described first text message, the formatted file that final generation is mated completely with display device.
Wherein, described text formatting comprises: the font of title, font size and font color etc.; The font of text paragraph, font size and font color etc.; Frame kind, border thickness and border color etc.
Here, described html file conversion method is the Java subalgorithm that the embodiment of the present invention provides, service end was by calling this algorithm, calculation process is carried out to the first formatted file character string primary traffic, the formatted file of different-format is converted to file that can be shown by terminal presentation facility, that take .html as suffix; That is, the text formatting of formatted file after changing is .html form, and such file is generally referred to as html file, can directly show in terminal device.
But it should be noted that, although the formatted file after conversion can show in terminal device, can not the specification of reflexless terminal equipment completely, also need to carry out further adaptation.Wherein, described terminal device can comprise: mobile phone, panel computer etc.
Here, when service end is determined to get the second text message, when namely defining the input of new text message variable, described method also comprises: the second resize ratio information redefining described primary importance information and described second place information according to the display specification of terminal device and described second Textual information; Five positional information of described second text message on described terminal device is determined according to described second resize ratio information; Six positional information of described pictorial information on described terminal device is determined according to described second resize ratio information; Described second text message and the display mode of described pictorial information on described terminal device is determined according to described 5th positional information and described 6th positional information.
Particularly, character string corresponding for the variate-value of input is converted to the formatted file that can be shown by device end coupling by service end according to html file conversion method; The string that the character string that text formatting after conversion is corresponding is placed in the first formatted file character string is first; Carry out suitability amendment according to the second text display form after conversion to described second character string again, to make the sharpness of picture, highly, width etc. can the specification of reflexless terminal equipment; According to the 5th positional information and the 6th positional information, amended second character string is inserted in the first character string, finally generate and export the formatted file that can mate with terminal presentation facility.
Wherein, described text message variable comprises: the font of title and text paragraph, font size and font color; Frame kind, border thickness and border color etc.
In addition, when only including the first text message in described formatted file, when not comprising pictorial information, described method also comprises: the 7th positional information obtaining described first text message; Obtain the display specification of described terminal device, determine the 3rd resize ratio information of described 7th positional information according to the display specification of described terminal device; Described first text message the 7th positional information is on the terminal device determined according to described 3rd resize ratio information; The display mode of described first text message on described terminal device is determined according to described 7th positional information.
Particularly, after getting the 7th positional information of described first text message, and mark in described first character string and obtain the start-stop position and string length that represent text formatting, text text, each self-corresponding character string of text header; Wherein, described 7th positional information comprises: the starting position of described first character string in the second formatted file character string and end position.
In addition, also need the caption position in the character string of location first and text segment dropping place to put, and row division is dropped into the text segment of described text-only file.
Here, after service end determines the display mode on described first text message terminal device according to described 7th positional information, according to html file conversion method, described first character string being converted to can by the file of terminal device coupling display, the string that the character string that text formatting after conversion is corresponding is placed in the second formatted file character string is first, finally generates and exports the formatted file that can mate with terminal presentation facility.
The adaptation method of the document display format that the embodiment of the present invention provides, a kind of directly by calling the Java adaptation method of terminal documentation display format, by the amendment of the string data stream to document, the terminal presentation facility of the adaptive different size of the display format making it final energy.Solve document when pushing from service end to terminal, former document format can not the problem of terminal presentation facility of automatic adaptation different size, achieve document automatic adaptation according to terminal presentation facility specification before serviced end pushes, and can need according to concrete propelling movement to do further manual fit to document format.The method can be widely used in the research and development of Mobile solution as class libraries, when greatly can improve research and development, the efficiency of document display format adaptation and speed, meet the needs of quick application and development.
Embodiment two
Corresponding to embodiment one, present embodiments provide a kind of adaptive device of document display format, as shown in Figure 2, described device comprises: reading unit 21, resolution unit 22 and determining unit 23; Wherein,
Described reading unit 21, for reading format file;
Described resolution unit 22, for resolving the formatted file that described reading unit 21 reads, when described formatted file comprises the first text message and pictorial information, obtain the primary importance information of described first text message and the second place information of described pictorial information;
Described determining unit 23, for obtaining the display specification of described terminal device, determines the first resize ratio information of described primary importance information and described second place information according to the display specification of described terminal device; Three positional information of described first text message on described terminal device is determined according to described first resize ratio information; Four positional information of described pictorial information on described terminal device is determined according to described first resize ratio information; Described first text message and the display mode of described pictorial information on described terminal device is determined according to described 3rd positional information and described 4th positional information.
Particularly, as shown in Figure 3, described reading unit 21 comprises: the first reading unit 31, second reading unit 32, third reading get unit 33; Wherein,
Described first reading unit 31, for utilizing formatted file read method, obtains the filename of formatted file according to the formatted file path of input;
Described second reading unit 32, for carrying out character string parsing according to formatted file form differentiating method to the filename that described first reading unit 31 gets, obtains the extension name of described formatted file;
Described third reading is got unit 33 and is called corresponding formatted file read method for the formatted file extension name got according to described second reading unit 32, reading format file.
Wherein, the kind of described formatted file form can comprise: .txt form .doc form .docx form .xls form .xlsx form, PDF and .pptx form etc.
Here, as shown in Figure 4, described resolution unit 22 comprises: the first resolution unit 41, second resolution unit 42, the 3rd resolution unit 43; When described third reading get unit 33 formatted file is read complete after, described parsing first module 41, specifically for: according to formatted file resolution rules, to described formatted file one by one character resolve, obtain the first formatted file character string;
When described first resolution unit 41 obtains the first formatted file character string, described second resolution unit 42, for judging whether comprise pictorial information in described first formatted file character string, when determining that described first formatted file character string comprises pictorial information, be separated the first character string representing the first text message in described first formatted file character string and the second character string representing pictorial information;
When described second resolution unit 42 is separated the first character string representing the first text message in described first formatted file character string and the second character string representing pictorial information, 3rd resolution unit 43, for marking the primary importance information of described first character string in described first formatted file character string and the second place information of described second character string in described first formatted file character string, to obtain primary importance information and second place information.
Here, because the formatted file of different-format has different character string characteristics, so the first character string and the second character string can be separated in the first formatted file character string according to character string characteristic by described second resolution unit 42; Described 3rd resolution unit 43 marks and obtains the start-stop position and string length that represent text formatting, text text, each self-corresponding character string of text header in described first character string; Mark in described second character string and obtain the start-stop position and string length that represent picture format, image content, each self-corresponding character string of picture header.Wherein, described primary importance information comprises: the starting position of described first character string in the first formatted file character string and end position; Described second place information comprises: the starting position of the second character string in the first formatted file character string and end position.
Here, described second resolution unit 42 utilizes setPicturesManager () method the second character string to be separated, and utilizes SavePicture () method to preserve the second character string separated.Wherein, the content in described second character string can comprise: the kind of picture, content, title, width, highly, sharpness etc.
In addition, also need the caption position in the character string of location first and text segment dropping place to put, and row division is dropped into the text segment of described text-only file.
Here, after described first character is separated with described second character string by described second resolution unit 42, described 3rd resolution unit 43 also will be resolved described pictorial information and is inserted into inserted mode in described first text message, can correctly show described text message and described pictorial information in terminal presentation facility; Wherein,
Described insertion comprises following several: described first text message is around described pictorial information; Described pictorial information floats on above described first text message; Described pictorial information to be lining in below described first text message etc.
After described 3rd resolution unit 43 gets described primary importance information and second place information, described determining unit 23, specifically for: the display specification obtaining described terminal device, the first resize ratio information of described primary importance information and described second place information is determined according to the display specification of described terminal device; Three positional information of described first text message on described terminal device is determined according to described first resize ratio information; Four positional information of described pictorial information on described terminal device is determined according to described first resize ratio information; Described first text message and the display mode of described pictorial information on described terminal device is determined according to described 3rd positional information and described 4th positional information.
Particularly, after described determining unit 23 utilizes window manager WindowManager to obtain the display specification of terminal device; Determine the first resize ratio information of described primary importance information and described second place information according to the display specification of the terminal device obtained, determine three positional information of described first text message on described terminal device according to described first resize ratio information; Three positional information of described pictorial information on described terminal device is determined according to described second resize ratio information.Wherein, the display specification of described terminal device comprises: the size, sharpness etc. of terminal device.
After described determining unit 23 determines described first text message and described pictorial information display mode on the terminal device according to described 3rd positional information and described 4th positional information, according to HTML conversion method, described first formatted file character string is converted to the file that can be shown by terminal presentation facility, the string that the character string that text formatting after conversion is corresponding is placed in the first formatted file character string is first, according to the first text display form after conversion, suitability amendment is carried out to described second character string again, according to the 3rd positional information and the 4th positional information, amended second character string is inserted in the first character string, complete adapting operation, the formatted file that final generation and display device mate completely, with the specification making the format of adaptive amended formatted file can mate display device, the format of described formatted file covers original form.
In addition, when amended second character string is inserted in the first character string according to the 3rd positional information and the 4th positional information by described determining unit 23, after completing adapting operation, also need according to the further adaptive described pictorial information of described inserted mode and described first text message, the formatted file that final generation is mated completely with display device.
Wherein, described text formatting comprises: the font of title, font size and font color etc.; The font of text paragraph, font size and font color etc.; Frame kind, border thickness and border color etc.
Here, described html file conversion method is the Java subalgorithm that the embodiment of the present invention provides, described determining unit 23 was by calling this algorithm, calculation process is carried out to the first formatted file character string primary traffic, the formatted file of different-format is converted to file that can be shown by terminal presentation facility, that take .html as suffix; That is, the text formatting of formatted file after changing is .html form, and such file is generally referred to as html file, can directly show in terminal presentation facility.
But it should be noted that, although the formatted file after conversion can show in terminal presentation facility, the specification of display device can not be mated completely, also need to carry out further adaptation.Wherein, described terminal presentation facility can comprise: mobile phone, panel computer etc.
Here, when described determining unit 23 is determined to get the second text message, when namely defining the input of new text message variable, also for the second resize ratio information of redefining described primary importance information and described second place information according to the display specification of terminal device and described second Textual information; Five positional information of described second text message on described terminal device is determined according to described second resize ratio information; Six positional information of described pictorial information on described terminal device is determined according to described second resize ratio information; Described second text message and the display mode of described pictorial information on described terminal device is determined according to described 5th positional information and described 6th positional information.
Particularly, character string corresponding for the variate-value of input is converted to the formatted file that can be shown by device end coupling by described determining unit 23 according to html file conversion method; The string that the character string that text formatting after conversion is corresponding is placed in the first formatted file character string is first; Carry out suitability amendment according to the second text display form after conversion to described second character string again, to make the sharpness of picture, highly, width etc. can the specification of reflexless terminal equipment; According to the 5th positional information and the 6th positional information, amended second character string is inserted in the first character string, finally generate and export the formatted file that can mate with terminal presentation facility.
Wherein, described text message variable comprises: the font of title and text paragraph, font size and font color; Frame kind, border thickness and border color etc.
In addition, when only including the first text message in described formatted file, when not comprising pictorial information, described determining unit 23 is also for the 7th positional information that obtains described first text message; Obtain the display specification of described terminal device, determine the 3rd resize ratio information of described 7th positional information according to the display specification of described terminal device; Described first text message the 7th positional information is on the terminal device determined according to described 3rd resize ratio information; The display mode of described first text message on described terminal device is determined according to described 7th positional information.
Particularly, after described determining unit 23 gets the 7th positional information of described first text message, mark in described first character string and obtain the start-stop position and string length that represent text formatting, text text, each self-corresponding character string of text header; Wherein, described 7th positional information comprises: the starting position of described first character string in the second formatted file character string and end position.
Here, after described determining unit 23 determines the display mode on described first text message terminal device according to described 7th positional information, according to html file conversion method, described first character string being converted to can by the file of terminal device coupling display, the string that the character string that text formatting after conversion is corresponding is placed in the second formatted file character string is first, finally generates and exports the formatted file that can mate with terminal presentation facility.
During practical application, the adaptive device provided in the embodiment of the present invention can realize in service end, and described reading unit 21 can be realized by the read write line in adaptive device; Described resolution unit 22 and described determining unit 23 can by the central processing unit (CPU in adaptive device, Central Processing Unit), digital signal processor (DSP, Digtal Signal Processor), programmable logic array (FPGA, Field Programmable Gate Array) realize.
The adaptation method of the document display format that the embodiment of the present invention provides and device, solve document when pushing from service end to terminal, former document format can not the problem of terminal presentation facility of automatic adaptation different size, achieve document automatic adaptation according to terminal presentation facility specification before serviced end pushes, and can need according to concrete propelling movement to do further manual fit to document format.The method can be widely used in the research and development of Mobile solution as class libraries, when greatly can improve research and development, the efficiency of document display format adaptation and speed, meet the needs of quick application and development.
Embodiment three
In practical application, when the adaptation method of the document display format that user uses the embodiment of the present invention to provide, can relaxedly and rapidly reading documents.
When user uses smart mobile phone or panel computer to browse webpage, after clicking the interested news of a certain bar, the request of reading this news can be sent to service end, after service end receives read requests by user side, utilize formatted file read method, read the formatted file of this news;
Particularly, described service end obtains the filename of formatted file according to the formatted file path of this news; According to formatted file form differentiating method, character string parsing is carried out to the filename got, obtain the extension name of described formatted file; Corresponding formatted file read method is called, reading format file according to the formatted file extension name got.
After service end reads the formatted file of this news, according to formatted file resolution rules, to described formatted file one by one character resolve, obtain the first formatted file character string; Judge whether comprise pictorial information in described first formatted file character string, when determining that described first formatted file character string comprises pictorial information, be separated the first character string representing the first text message in described first formatted file character string and the second character string representing pictorial information; Mark the primary importance information of described first character string in described first formatted file character string and the second place information of described second character string in described first formatted file character string, to obtain primary importance information and second place information.
Particularly, because the formatted file of different-format has different character string characteristics, so the first character string and the second character string can be separated in the first formatted file character string according to character string characteristic; And mark in described first character string and obtain the start-stop position and string length that represent text formatting, text text, each self-corresponding character string of text header; Mark in described second character string and obtain the start-stop position and string length that represent picture format, image content, each self-corresponding character string of picture header.Wherein, described primary importance information comprises: the starting position of described first character string in the first formatted file character string and end position; Described second place information comprises: the starting position of the second character string in the first formatted file character string and end position.
Here, service end utilizes setPicturesManager () method the second character string to be separated, and utilizes SavePicture () method to preserve the second character string separated.Wherein, the content in described second character string can comprise: the kind of picture, content, title, width, highly, sharpness etc.
In addition, also need the caption position in the character string of location first and text segment dropping place to put, and row division is dropped into the text segment of described text-only file.
Here, after described first character is separated with described second character string by described service end, also to resolve described pictorial information and be inserted into inserted mode in described first text message, so that described text message and described pictorial information can be shown better in smart mobile phone or panel computer; Wherein,
Described inserted mode comprises following several: described first text message is around described pictorial information; Described pictorial information floats on above described first text message; Described pictorial information to be lining in below described first text message etc.
After described service end gets described inserted mode, window manager WindowManager also will be utilized to detect smart mobile phone that user uses or the display specification of panel computer, determines the first resize ratio information of described primary importance information and described second place information according to the display specification of smart mobile phone or panel computer; Three positional information of described first text message on described smart mobile phone or panel computer is determined according to described first resize ratio information; Four positional information of described pictorial information on described smart mobile phone or panel computer is determined according to described first resize ratio information; Wherein, described display specification comprises: smart mobile phone or panel computer size, sharpness etc.
When after the display mode that service end to be determined according to described 3rd positional information and described 4th positional information on described first text message and described pictorial information smart mobile phone or panel computer, according to html file conversion method, first described first character string is converted to the file that can be shown by smart mobile phone or panel computer coupling, the string that the character string that the text formatting after conversion is corresponding is placed in the first formatted file character string is first; According to the first text display form after conversion, suitability amendment is carried out to described second character string again, according to the 3rd positional information and the 4th positional information, amended second character string is inserted in the first character string, complete adapting operation, to make the format of adaptive amended formatted file can the smart mobile phone that uses of match user or the display specification of panel computer, the format of described formatted file covers original form.
In addition, when amended second character string is inserted in the first character string according to the 3rd positional information and the 4th positional information by described service end, after completing adapting operation, also need according to the further adaptive described pictorial information of described inserted mode and described first text message, the smart mobile phone that final generation and user use or the formatted file that panel computer mates completely, can allow user browse to this news easily.
Wherein, described text formatting comprises: the font of title, font size and font color etc.; The font of text paragraph, font size and font color etc.; Frame kind, border thickness and border color etc.
Here, when user clicks text advertisements on this news browsing page or other text messages, described service end has then recognized the second text message input, when service end is determined to get the second text message, when namely defining the input of new text message variable, the display specification of the smart mobile phone that described service end uses according to user or panel computer and described second Textual information redefine the second resize ratio information of described primary importance information and described second place information; Five positional information of described second text message on described smart mobile phone or panel computer is determined according to described second resize ratio information; Six positional information of described pictorial information on described smart mobile phone or panel computer is determined according to described second resize ratio information; Described second text message and the display mode of described pictorial information on described smart mobile phone or panel computer is determined according to described 5th positional information and described 6th positional information.
Particularly, character string corresponding for the variate-value of input is converted to the formatted file that can be shown by smart mobile phone or panel computer coupling by service end according to html file conversion method; The string that the character string that text formatting after conversion is corresponding is placed in the first formatted file character string is first; Carry out suitability amendment according to the second text display form after conversion to described second character string again, to make the sharpness of picture, highly, width etc. can mate the display specification of smart mobile phone or panel computer; According to the 5th positional information and the 6th positional information, amended second character string is inserted in the first character string, finally generate and export the formatted file that can mate with smart mobile phone or panel computer.
Wherein, described text message variable comprises: the font of title and text paragraph, font size and font color; Frame kind, border thickness and border color etc.
In addition, when only including the first text message in described formatted file, when not comprising pictorial information, described service end is then for the 7th positional information that obtains described first text message; Obtain smart mobile phone or the display specification of panel computer that described user uses, determine the 3rd resize ratio information of described 7th positional information according to the display specification of described smart mobile phone or panel computer; The 7th positional information on described first text message is on smart mobile phone or panel computer is determined according to described 3rd resize ratio information; The display mode of described first text message on smart mobile phone or panel computer on equipment is determined according to described 7th positional information.
Particularly, after described service end gets the 7th positional information of described first text message, and mark in described first character string and obtain the start-stop position and string length that represent text formatting, text text, each self-corresponding character string of text header; Wherein, described 7th positional information comprises: the starting position of described first character string in the second formatted file character string and end position.
In addition, also need the caption position in the character string of location first and text segment dropping place to put, and row division is dropped into the text segment of described text-only file.
Here, after service end determines the display mode of described first text message on smart mobile phone or panel computer on equipment according to described 7th positional information, according to html file conversion method, described first character string being converted to can by the file of equipment coupling display on smart mobile phone or panel computer, the string that the character string that text formatting after conversion is corresponding is placed in the second formatted file character string is first, and finally generating and export can with the formatted file that smart mobile phone or panel computer mate.
Like this, user completely without the need to consider use the specification of terminal presentation facility whether to meet the display format of this webpage, just comfortablely can browse webpage or other information quickly.
The above, be only preferred embodiment of the present invention, be not intended to limit protection scope of the present invention, and all any amendments done within the spirit and principles in the present invention, equivalent replacement and improvement etc., all should be included within protection scope of the present invention.

Claims (10)

1. an adaptation method for document display format, described method is applied to terminal device, it is characterized in that, described method comprises:
Reading format file;
Resolve described formatted file, when described formatted file comprises the first text message and pictorial information, obtain the primary importance information of described first text message and the second place information of described pictorial information;
Obtain the display specification of described terminal device, determine the first resize ratio information of described primary importance information and described second place information according to the display specification of described terminal device;
Three positional information of described first text message on described terminal device is determined according to described first resize ratio information;
Four positional information of described pictorial information on described terminal device is determined according to described first resize ratio information;
Described first text message and the display mode of described pictorial information on described terminal device is determined according to described 3rd positional information and described 4th positional information.
2. method according to claim 1, is characterized in that, described reading format file comprises:
The filename of formatted file is obtained according to the formatted file path of input;
According to formatted file form differentiating method, character string parsing is carried out to the filename got, obtain the extension name of described formatted file;
Corresponding file reading is called, reading format file according to the formatted file extension name got.
3. method according to claim 1, it is characterized in that, the described formatted file of described parsing, when described formatted file comprises the first text message and pictorial information, obtain the primary importance information of described first text message and the second place information of described pictorial information, specifically comprise:
According to formatted file resolution rules, described formatted file is resolved to the first formatted file character string;
Be separated the first character string representing the first text message in described first formatted file character string and the second character string representing pictorial information;
Obtain the primary importance information of described first character string in described first formatted file character string and the second place information of described second character string in described first formatted file character string.
4. method according to claim 1, is characterized in that, after determining described first text message and the display mode of described pictorial information on described terminal device according to described 3rd positional information and described 4th positional information, described method also comprises:
When getting the second text message, redefine the second resize ratio information of described primary importance information and described second place information according to the display specification of terminal device and described second Textual information;
Five positional information of described second text message on described terminal device is determined according to described second resize ratio information;
Six positional information of described pictorial information on described terminal device is determined according to described second resize ratio information;
Described second text message and the display mode of described pictorial information on described terminal device is determined according to described 5th positional information and described 6th positional information.
5. method according to claim 1, is characterized in that, when described formatted file comprises the first text message, described method also comprises:
Obtain the 7th positional information of described first text message;
Obtain the display specification of described terminal device, determine the 3rd resize ratio information of described 7th positional information according to the display specification of described terminal device;
Described first text message the 7th positional information is on the terminal device determined according to described 3rd resize ratio information;
The display mode of described first text message on described terminal device is determined according to described 7th positional information.
6. an adaptive device for document display format, is characterized in that, described device comprises:
Reading unit, described reading unit is used for reading format file;
Resolution unit, the formatted file that described resolution unit reads for resolving described reading unit, when described formatted file comprises the first text message and pictorial information, obtain the primary importance information of described first text message and the second place information of described pictorial information;
Determining unit, described determining unit, for obtaining the display specification of described terminal device, determines the first resize ratio information of described primary importance information and described second place information according to the display specification of described terminal device;
Three positional information of described first text message on described terminal device is determined according to described first resize ratio information;
Four positional information of described pictorial information on described terminal device is determined according to described first resize ratio information;
Described first text message and the display mode of described pictorial information on described terminal device is determined according to described 3rd positional information and described 4th positional information.
7. device according to claim 6, is characterized in that, described reading unit comprises:
First reading unit, described first reading unit is used for the filename obtaining formatted file according to the formatted file path of input;
Second reading unit, described second reading unit is used for carrying out character string parsing according to formatted file form differentiating method to the filename that described first reading unit gets, and obtains the extension name of described formatted file;
Third reading gets unit, and described third reading is got unit and called corresponding file reading for the formatted file extension name got according to described second reading unit, reading format file.
8. device according to claim 6, is characterized in that, described resolution unit comprises:
First resolution unit, described first resolution unit is used for according to formatted file resolution rules, described formatted file is resolved to the first formatted file character string;
Second resolution unit, described second resolution unit is for separating of representing the first character string of the first text message in described first formatted file character string and representing the second character string of pictorial information;
3rd resolution unit, described 3rd resolution unit is for obtaining the primary importance information of described first character string in described first formatted file character string and the second place information of described second character string in described first formatted file character string.
9. device according to claim 6, it is characterized in that, after determining described first text message and the display mode of described pictorial information on described terminal device according to described 3rd positional information and described 4th positional information, described determining unit also for:
When getting the second text message, redefine the second resize ratio information of described primary importance information and described second place information according to the display specification of terminal device and described second Textual information;
Five positional information of described second text message on described terminal device is determined according to described second resize ratio information;
Six positional information of described pictorial information on described terminal device is determined according to described second resize ratio information;
Described second text message and the display mode of described pictorial information on described terminal device is determined according to described 5th positional information and described 6th positional information.
10. device according to claim 6, is characterized in that, when described formatted file comprises the first text message, described determining unit also for:
Obtain the 7th positional information of described first text message;
Obtain the display specification of described terminal device, determine the 3rd resize ratio information of described 7th positional information according to the display specification of described terminal device;
Described first text message the 7th positional information is on the terminal device determined according to described 3rd resize ratio information;
The display mode of described first text message on described terminal device is determined according to described 7th positional information.
CN201410457408.1A 2014-09-10 2014-09-10 A kind of adaptation method and device of document display format Active CN104216868B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410457408.1A CN104216868B (en) 2014-09-10 2014-09-10 A kind of adaptation method and device of document display format

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410457408.1A CN104216868B (en) 2014-09-10 2014-09-10 A kind of adaptation method and device of document display format

Publications (2)

Publication Number Publication Date
CN104216868A true CN104216868A (en) 2014-12-17
CN104216868B CN104216868B (en) 2019-02-01

Family

ID=52098374

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410457408.1A Active CN104216868B (en) 2014-09-10 2014-09-10 A kind of adaptation method and device of document display format

Country Status (1)

Country Link
CN (1) CN104216868B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106874252A (en) * 2017-02-17 2017-06-20 张家口浩扬科技有限公司 A kind of document identification and display methods and its mobile terminal
CN109325215A (en) * 2018-12-04 2019-02-12 万兴科技股份有限公司 The output method and device of Word text
CN110032718A (en) * 2019-04-12 2019-07-19 广州广燃设计有限公司 A kind of table conversion method, system and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1686464A2 (en) * 2005-02-01 2006-08-02 LG Electronics Inc. Separating content data, style sheets data and soft keys data in XML user interfaces for mobile stations
CN101364216A (en) * 2008-09-22 2009-02-11 中兴通讯股份有限公司 Method and device for displaying electronic book documentary on mobile terminal
CN101923723A (en) * 2009-06-16 2010-12-22 汉王科技股份有限公司 Method for realizing display of electronic document
CN102880460A (en) * 2012-08-15 2013-01-16 北京小米科技有限责任公司 Analyzing method and device of note content
CN103186505A (en) * 2011-12-30 2013-07-03 北大方正集团有限公司 Method and device for determining display mode of electronic document

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1686464A2 (en) * 2005-02-01 2006-08-02 LG Electronics Inc. Separating content data, style sheets data and soft keys data in XML user interfaces for mobile stations
CN101364216A (en) * 2008-09-22 2009-02-11 中兴通讯股份有限公司 Method and device for displaying electronic book documentary on mobile terminal
CN101923723A (en) * 2009-06-16 2010-12-22 汉王科技股份有限公司 Method for realizing display of electronic document
CN103186505A (en) * 2011-12-30 2013-07-03 北大方正集团有限公司 Method and device for determining display mode of electronic document
CN102880460A (en) * 2012-08-15 2013-01-16 北京小米科技有限责任公司 Analyzing method and device of note content

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106874252A (en) * 2017-02-17 2017-06-20 张家口浩扬科技有限公司 A kind of document identification and display methods and its mobile terminal
CN109325215A (en) * 2018-12-04 2019-02-12 万兴科技股份有限公司 The output method and device of Word text
CN109325215B (en) * 2018-12-04 2023-02-10 万兴科技股份有限公司 Word text output method and device
CN110032718A (en) * 2019-04-12 2019-07-19 广州广燃设计有限公司 A kind of table conversion method, system and storage medium
CN110032718B (en) * 2019-04-12 2023-04-18 广州广燃设计有限公司 Table conversion method, system and storage medium

Also Published As

Publication number Publication date
CN104216868B (en) 2019-02-01

Similar Documents

Publication Publication Date Title
US10318614B2 (en) Transformation of marked-up content into a file format that enables automated browser based pagination
CN100363883C (en) Printer with a web server embedded therein and printing method thereof
CN103389969B (en) A kind of methods, devices and systems for mobile terminal preview pdf document
US9690770B2 (en) Analysis of documents using rules
US20030158969A1 (en) Authoring of media content and dissemination via an information technology network
CN101361063A (en) System and method supporting document content mining based on rules
CN101364216B (en) Method and device for displaying electronic book documentary on mobile terminal
CN102929867A (en) Technology used for automatically translating a document
CN103353878A (en) Method for displaying files of different file formats in webpage
CN103166981A (en) Wireless webpage transcoding method and device
CN102402432A (en) Method for creating a multi-lingual web page
CN105824788A (en) Method and system for converting PowerPoint file into word file
CN101430684A (en) Method and apparatus for mutual conversion between Chinese work office software document and documents with other format
CN101916293A (en) Method and device for introducing media information into file
KR20150144073A (en) Method and apparatus for format conversion of document, and cloud server thereof
CN104281589A (en) Mathematical formula searching method and device
CN105760501A (en) Document format conversion method and device
CN112527291A (en) Webpage generation method and device, electronic equipment and storage medium
US10628526B2 (en) Providing suggested diagrammatic representations of user entered textual information
CN104216868A (en) Adaptation method and device for document display format
CN107562450A (en) A kind of cross-platform method for visualizing of local chronicle resource
Sikos Web Standards: Mastering HTML5, CSS3, and XML
CN104090869A (en) Network information translating method and translating system
WO2018179002A1 (en) Transformation of marked-up content into a file format that enables automated browser based pagination
CN104077323A (en) Method and device for converting web page content to multimedia messages

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant