Document signature layout method and device, and electronic equipment

By acquiring key information and space-filling information for document signatures, the system automatically fills in spaces to achieve document signature formatting. This solves the problems of cumbersome operation and low accuracy of traditional formatting methods, improves formatting efficiency and accuracy, and supports the efficient work of the court.

CN118798130BActive Publication Date: 2026-02-06SHENZHEN HAIGUI NETWORK TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410955497.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-17
Publication Date
2026-02-06
Estimated Expiration
2044-07-17

AI Technical Summary

Technical Problem

Traditional document signing and formatting methods are cumbersome and have low accuracy and efficiency, making it difficult to guarantee the high real-time performance of court case filing and handling.

Method used

By obtaining key information from the document signature, and using field length configuration information and actual text length to determine the space filling information, the system automatically fills in spaces to achieve the proper formatting of the document signature.

Benefits of technology

It simplifies the operation, improves the accuracy and efficiency of document signature layout, ensures that document signatures meet alignment requirements, and helps to ensure the high real-time performance of court case filing and handling.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118798130B_ABST
    Figure CN118798130B_ABST
Patent Text Reader

Abstract

The application provides a document signature layout method and device and electronic equipment, obtains key information of a document signature; obtains field length configuration information corresponding to the key information; determines actual text lengths corresponding to positions, names and dates respectively, and determines space filling information corresponding to the key information based on the field length configuration information and the actual text lengths; fills spaces for the key information based on the space filling information, and renders the document signature based on filled information obtained after the spaces are filled to obtain a layout result of the document signature. The application can alleviate the problems of complicated operation, low accuracy and low efficiency of a traditional document signature layout method.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of data processing, and in particular to a document signature layout method and device and electronic equipment. BACKGROUND

[0002] There are relatively standard requirements for signatures in the output process of court legal documents. Generally, it needs to involve role variables such as undertakers, clerks, judge assistants, judges, shorthand clerks, and collegial bench members, as well as Chinese capital dates (the date may be the current date, the filing date, the actual court time, etc.), and the text content corresponding to each role variable and date usually needs to meet the alignment requirements of the signature. The traditional document signature layout method is usually directly laid out by manual operation to make the signature meet the corresponding alignment requirements, but manual layout operation is tedious and has low accuracy and efficiency, which is difficult to guarantee the high real-time performance of court filing and case handling. SUMMARY

[0003] Therefore, the purpose of the present application is to provide a document signature layout method, device and electronic equipment to alleviate the problem of tedious operation and low accuracy and efficiency of the traditional document signature layout method.

[0004] In a first aspect, the embodiments of the present application provide a document signature layout method, which comprises: obtaining key information of a document signature; wherein the key information comprises the post and name of the role variable contained in the document signature and the date contained in the document signature; obtaining field length configuration information corresponding to the key information; wherein the field length configuration information comprises a first field length corresponding to each of the preconfigured post and name and a second field length corresponding to the space between the preconfigured post and name; determining the actual text length corresponding to each of the post, name and date, and determining the space filling information corresponding to the key information based on the field length configuration information and the actual text length; wherein the space filling information comprises the number and manner of space filling corresponding to each of the post, name and date; filling the space for the key information based on the space filling information, and rendering the document signature based on the filled information obtained after filling the space to obtain the layout result of the document signature.

[0005] In a second aspect, the embodiments of the present application further provide a document signature layout device, which comprises: a first obtaining module configured to obtain key information of a document signature; wherein the key information comprises a post and a name of a role variable contained in the document signature, and a date contained in the document signature; a second obtaining module configured to obtain field length configuration information corresponding to the key information; wherein the field length configuration information comprises a first field length corresponding to the post and the name respectively, and a second field length corresponding to a space between the post and the name; a determining module configured to determine actual text lengths corresponding to the post, the name and the date respectively, and determine space filling information corresponding to the key information based on the field length configuration information and the actual text lengths; wherein the space filling information comprises a space filling number and a space filling mode corresponding to the post, the name and the date respectively; and a filling and rendering module configured to fill spaces for the key information based on the space filling information, and render the document signature based on filled information obtained after the spaces are filled to obtain a layout result of the document signature.

[0006] In a third aspect, the embodiments of the present application further provide an electronic device, comprising a processor and a memory, wherein the memory stores computer executable instructions capable of being executed by the processor, and the processor executes the computer executable instructions to implement the document signature layout method of the first aspect.

[0007] The embodiments of the present application provide a document signature layout method, device and electronic device, which obtain key information of a document signature, obtain field length configuration information corresponding to the key information, determine actual text lengths corresponding to a post, a name and a date respectively, and determine space filling information corresponding to the key information based on the field length configuration information and the actual text lengths, fill spaces for the key information based on the space filling information, and render the document signature based on filled information obtained after the spaces are filled to obtain a layout result of the document signature. By using the above technology, spaces can be filled for the key information based on the field length configuration information and the actual text lengths of the key information, so as to realize automatic layout of the document signature, and thus the document signature meets corresponding alignment requirements. Compared with a traditional document signature layout method, the above method simplifies operation and improves accuracy and efficiency of document signature layout, thereby facilitating to ensure high real-time performance of court case filing and handling.

[0008] Other features and advantages of the present application will be set forth in the following description, and in part will become apparent to those skilled in the art from the description, or can be learned by practice of the present application. The objects and other advantages of the present application will be realized and achieved by the structure particularly pointed out in the description, claims and drawings.

[0009] In order to make the above objectives, characteristics and advantages of the present application more apparent, comprehensible and easier to understand, the following will describe a preferred embodiment in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF DRAWINGS

[0010] In order to make the above objectives, characteristics and advantages of the present application more apparent, comprehensible and easier to understand, the following will describe a preferred embodiment in detail with reference to the accompanying drawings.

[0011] Figure 1 A flowchart of a document signature layout method in an embodiment of the present application;

[0012] Figure 2 A partial example diagram of a document template and a corresponding part of a document signature in an embodiment of the present application;

[0013] Figure 3 A layout result example diagram of a document signature in an embodiment of the present application;

[0014] Figure 4 A general framework example diagram of a document signature layout method in an embodiment of the present application;

[0015] Figure 5 An example diagram of hidden code content of a document template in an embodiment of the present application;

[0016] Figure 6 A character length configuration interface example diagram of a client in an embodiment of the present application;

[0017] Figure 7 A function configuration interface example diagram of a document center background management system in an embodiment of the present application;

[0018] Figure 8 A function parameter setting interface example diagram of a client word plug-in in an embodiment of the present application;

[0019] Figure 9 A function source code setting interface example diagram of a client word plug-in in an embodiment of the present application;

[0020] Figure 10 A structure schematic diagram of a document signature layout device in an embodiment of the present application;

[0021] Figure 11 A structure schematic diagram of an electronic device in an embodiment of the present application. DETAILED DESCRIPTION

[0022] In order to make the purposes, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions of the present application will be described clearly and completely below in connection with the embodiments. Obviously, the described embodiments are only some of the embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work fall within the scope of protection of the present application.

[0023] At present, the traditional document signature typesetting method is usually directly typesetting by manual operation to make the signature meet the corresponding alignment requirements, but the manual typesetting operation is tedious and the accuracy and efficiency are relatively low, and it is difficult to guarantee the high real-time performance of court case filing and handling.

[0024] Based on this, the document signature typesetting method, device and electronic equipment provided by the present application can alleviate the problem of tedious operation and low accuracy and efficiency of the traditional document signature typesetting method.

[0025] In order to facilitate the understanding of the present embodiment, first, a document signature typesetting method disclosed by the present embodiment is introduced in detail, referring to Figure 1 The method can include the following steps:

[0026] Step S102, obtaining the key information of the document signature.

[0027] The key information can include the post and name of the role variable contained in the document signature, and the date contained in the document signature, and the like, which is not limited.

[0028] Step S104, obtaining the field length configuration information corresponding to the key information.

[0029] The field length configuration information can include the first field length corresponding to the post and name respectively, and the second field length corresponding to the space between the post and the name, and the like, which is not limited.

[0030] For example Figure 2 As shown in the figure, the role variable contained in the document signature includes a judge and a clerk, and the presentation form of each of the role variables judge and clerk is a post, a space and a name arranged in order from left to right, and the field length (i.e. the total length of the presented field to meet the alignment requirements of the document signature) configured for the post, the space and the name respectively is 10, 4 and 24, and the configured field length is presented in the corresponding position of the document template in the form of a superscript, so that when the post, the name and the date are obtained, the configured field length can be directly obtained and used for subsequent processing.

[0031] In step S106, the actual text lengths corresponding to the post, name and date respectively are determined, and the space filling information corresponding to the key information is determined based on the field length configuration information and the actual text lengths.

[0032] The space filling information can include the number of spaces filled and the space filling mode corresponding to the post, name and date respectively, and is not limited in this regard.

[0033] In step S108, spaces are filled for the key information based on the space filling information, and the layout result of the document signature is obtained by rendering the document signature based on the filled information obtained after the spaces are filled.

[0034] Figure 3 The layout result of the document signature is shown in the examples, Figure 3 The presentation forms of the respective posts of the judges and the clerks are “judge” and “clerk” respectively, there are four half spaces between the post and the name, the presentation forms of the respective names of the judges and the clerks are “XXXXXX·XXXXX” and “handling person - Li judge” respectively, and the presentation form of the date is “2024 June 17”. As shown in Figure 3 The post and the name of the document signature have been aligned according to the specified length respectively, the post and the name have been aligned according to the specified length, the length of the date is consistent with the total length from the first word of the post to the last word of the name, and the date as a whole is aligned with the whole from the first word of the post to the last word of the name.

[0035] The document signature layout method provided by the embodiment of the application obtains key information of a document signature, obtains field length configuration information corresponding to the key information, determines actual text lengths corresponding to the post, name and date respectively, and determines space filling information corresponding to the key information based on the field length configuration information and the actual text lengths. Spaces are filled for the key information based on the space filling information, and the layout result of the document signature is obtained by rendering the document signature based on the filled information obtained after the spaces are filled. By using the above technology, spaces can be filled for the key information of the document signature by using the corresponding field length configuration information and the actual text lengths of the key information, so as to realize automatic layout of the document signature, and thus the document signature can meet the corresponding alignment requirements. Compared with the traditional document signature layout method, the operation is simplified, and the accuracy and efficiency of the document signature layout are improved, so as to facilitate guaranteeing high real-time performance of court case filing and handling.

[0036] As one possible implementation, determining the actual text length corresponding to each of the job title, name, and date in step S106 above may include: counting the number of first characters in the text corresponding to each job title, and determining the number of first characters as the first actual text length corresponding to the job title; counting the number of second characters in the text corresponding to each name, and determining the number of second characters as the second actual text length corresponding to the name; converting the date into Chinese uppercase date text, counting the number of third characters in the date text, and determining the number of third characters as the third actual text length corresponding to the date.

[0037] For example Figure 3 As shown, after converting the date to Chinese capital letters "2024-6-17", it can be seen that the text corresponding to the position "Judge" and "Clerk" each occupy 6 characters, and the text corresponding to the name "XXXXXX·XXXXX" and "Case Handler - Judge Li" occupy 24 characters and 14 characters respectively, and the date text "2024-6-17" occupies 20 characters.

[0038] As one possible implementation, the space padding information corresponding to the key information in step S106 above, based on the field length configuration information and the actual text length, may include:

[0039] Step 1: Based on the length of the first field corresponding to the job position and the length of the first actual text, determine the first space padding information corresponding to the job position; wherein, the first space padding information may include the number of first spaces and the first space padding method corresponding to each job position.

[0040] For example Figure 3 As shown, based on the known configured field length and character count of the text corresponding to the job title (i.e., "Judge" and "Clerk"), it can be determined that the text corresponding to the job title needs to be filled with a total of 4 half-width spaces and 2 half-width spaces between each two adjacent characters, so that the job title content in each line after filling occupies a total of 10 characters.

[0041] Step 2: Based on the length of the first field corresponding to the name and the second actual text length, determine the second space padding information corresponding to the name; wherein, the second space padding information may include the number of second spaces and the second space padding method for each name.

[0042] Continuing from the previous example, such as Figure 3As shown, based on the configured field length and character occupation number of the text corresponding to the known name (i.e. "XXXXXX·XXXXX" and "Clerk—Judge Li"), it is determined that "XXXXXX·XXXXX" does not need to be filled with spaces because it has already occupied 24 characters, and it is determined that "Clerk—Judge Li" needs to be filled with 10 half-width spaces in total and 2 half-width spaces between each adjacent two words and 1 half-width space between the "—" and the word, so that the obtained name content of each line after filling occupies 24 characters in total.

[0043] In step 3, the third space filling information corresponding to the date is determined based on the first field length, the second field length and the third actual text length; wherein the third space filling information can include the third space filling number and the third space filling mode corresponding to the date.

[0044] Exemplarily, the operation mode of the above step 3 can be: based on the first field length and the second field length, the third field length corresponding to the date text is determined; wherein the third field length represents the sum of the maximum value of the first field length corresponding to the post, the maximum value of the first field length corresponding to the name and the second field length; based on the third field length, the third space filling information is determined.

[0045] Continuing the previous example, as shown in Figure 3 Based on the configured field length and character occupation number of the text corresponding to the known post, the text corresponding to the known name, the space between the post and the name, and the date text, it is first calculated that the date content to be presented needs to occupy 38 (i.e. 10+4+24) characters, and then it is determined that the date text "June 17, 2024" needs to be filled with 18 half-width spaces in total and 2 half-width spaces between each adjacent two words, so that the obtained date content occupies 38 characters in total after filling.

[0046] As a possible implementation, the above step S108 of filling spaces for the key information based on the space filling information can include: filling spaces for each post based on the first space filling number and the first space filling mode corresponding to each post to obtain the filled post information corresponding to each post; filling spaces for each name based on the second space filling number and the second space filling mode corresponding to each name to obtain the filled name information corresponding to each name; filling spaces for the date based on the third space filling number and the third space filling mode corresponding to the date to obtain the filled date information corresponding to the date.

[0047] Continuing the previous example, as shown in Figure 3As shown, for the text corresponding to the post "judge" and "clerk", 2 half-width spaces can be filled between each adjacent two characters, so that each line of post content obtained after filling occupies 10 characters; for the text corresponding to the name, the operation of filling spaces can not be performed on "XXXXXX·XXXXX", and 2 half-width spaces are filled between each adjacent two characters of "person—Li judge", and 1 half-width space is filled between "person" and "—" and between "—" and "Li" respectively, so that each line of name content obtained after filling occupies 24 characters in total; for the date text "June 17, 2024", 2 half-width spaces can be filled between each adjacent two characters, so that the date content obtained after filling occupies 38 (i.e. 10+4+24) characters.

[0048] As a possible implementation, the rendering of the document seal based on the filled information obtained after filling spaces in step S108 to obtain the layout result of the document seal can include: using the template engine corresponding to the document to render the obtained filled post information, filled name information and filled date information, and taking the rendered result as the layout result.

[0049] Taking a word file as an example, the contents (i.e. post content, name content and date content) obtained by filling spaces on the text corresponding to the post, the text corresponding to the name and the date text can be rendered by the word template engine, so that the text content obtained by rendering the word template engine is taken as the layout result of the document seal.

[0050] As a possible implementation, the above step S102 (i.e. obtaining the key information of the document seal) can include:

[0051] Step A1, performing text analysis on the document, and obtaining the key corresponding to the preset template of the document seal by regular matching.

[0052] The key can include a first key corresponding to a role variable and a second key corresponding to a date, the first key can represent a first position of the post in the preset template and a second position of the name in the preset template, and the second key can represent a third position of the date in the preset template.

[0053] For example, a regular expression for regular matching can be constructed in advance, so that after the document seal is parsed from the document, the first key and the second key corresponding to the preset template of the document seal can be obtained by using the regular expression.

[0054] Step A2, obtaining the post and name of the role variable based on the first key.

[0055] Exemplarily, the content in the parsed document seal corresponding to the first position in the preset template can be extracted as the post by using the first keyword corresponding to the role variable, and the content in the parsed document seal corresponding to the second position in the preset template can be extracted as the name.

[0056] Step A3, obtaining the original date data corresponding to the date based on the second keyword, and calculating the date by using the original date data corresponding to the date by using the JS engine.

[0057] Exemplarily, the JS function for calculating the date can be configured on the JS engine in advance, and after obtaining the second keyword corresponding to the date, the content in the parsed document seal corresponding to the third position in the preset template can be extracted as the original date data by using the second keyword, and then the original date data is calculated by using the configured JS function by the JS engine to calculate the date.

[0058] As a possible implementation, before the above step S104 (obtaining the field length configuration information corresponding to the key information), the document seal layout method can further include: providing a field length configuration interface for a user to configure the first field length and the second field length. Based on this, the above step S104 can include: obtaining the field length configured by the user as the field length configuration information. Using the above operation mode of providing the field length configuration interface, the convenience and intuitiveness of the field length configuration are improved, thereby facilitating the accuracy of the field length configuration information acquisition.

[0059] For ease of understanding, the operation mode of the above document seal layout method is exemplarily described as follows by taking a specific application as an example.

[0060] Referring to Figure 4 As shown in the figure, taking a word file as an example, the above document seal layout method can be mainly realized by a document center and a client with a word plug-in, the client mainly configures a document template (here, a word template) through the word plug-in, and the document center mainly renders the content provided by the client (i.e., performs intelligent seal calculation) through a server. The intelligent seal calculation process mainly includes: analyzing the document seal based on the text, and obtaining the keywords in the document seal by regular matching, and then performing post processing, space processing, name processing and date processing.

[0061] The post processing mode mainly includes:

[0062] (1.1) Obtain the configured field length.

[0063] (1.2) Calculate the number of characters.

[0064] (1.3) Fill in the half-space according to the configuration.

[0065] The way of filling half-space according to the configuration can be: obtaining the shortest required length, such as "clerk", the court requires to display at least 5 characters wide (i.e. the shortest required length is 5 characters), and needs to be displayed as "clerk"; calculating how many characters need to be extended; adding half-space to all word blocks of the post.

[0066] The space processing mode mainly includes:

[0067] (2.1) Obtain the field length configured.

[0068] (2.2) Fill half-space according to the configuration.

[0069] The way of filling half-space according to the configuration here can be: directly adding half-space at the specified position.

[0070] The name processing mode mainly includes:

[0071] (3.1) Obtain the name content based on the word template.

[0072] Specifically, the template engine customized in the word plug-in can be used to render the name variable placeholder in the word template into content text, and then the part of the content text rendered is extracted as the name content.

[0073] (3.2) The space filling logic is the same as (1.1)-(1.3) in the post processing mode, which will not be repeated here.

[0074] The date processing mode mainly includes:

[0075] (4.1) Obtain the date content based on the JS engine.

[0076] Specifically, the JS engine customized in the word plug-in can be used to render the date variable placeholder in the word template into content text, and then the part of the content text rendered is extracted as the date content. The JS function can be pre-configured in the JS engine, and after the JS engine finds the date variable placeholder in the word template, it can parse all the configured JS functions to obtain the configured JS function corresponding to the date variable placeholder by using the function id, and use the function parameters of the obtained JS function to calculate (i.e. render) the date variable placeholder to obtain the Chinese capital form date text, so as to output the obtained date text as the date content to the word content.

[0077] (4.2) The space filling logic is the same as (1.1)-(1.3) in the post processing mode, which will not be repeated here.

[0078] After the above post processing, the above space processing, the above name processing and the above date processing, the maximum value of the line record (i.e. the field length of the line with the maximum field length in the signature) can be calculated, and the field length of the date content is compared with the maximum value of the line record to determine whether the date is shorter than the signature. The specific determination process can be: if the field length of the date content is less than the maximum value of the line record, it is determined that the date is shorter than the signature, and if the field length of the date content is not less than the maximum value of the line record, it is determined that the date is not shorter than the signature. If the date is shorter than the signature, the indentation amount of the date is set and the scattered alignment of the date is set to align or nearly align the date with the signature. The indentation amount = page width - margin - maximum value of line record, and the obtained signature text (i.e. the text corresponding to the post, name and date after processing respectively) is rendered, and the rendering result is taken as the layout result of the document signature. If the date is not shorter than the signature, the obtained signature text is directly rendered, and the rendering result is taken as the layout result of the document signature.

[0079] Figure 2 The part corresponding to the document signature in the document template configured by the client through the word plug-in is shown. Figure 3 The result (i.e. layout result) output by the document center after intelligent signature calculation through the server is shown. Figure 5 The code content hidden in the document template is shown.

[0080] For example, on the client side, the word template can be constructed through the word function area plug-in developed by vsto, and the required display content and the required hidden code content are inserted into the word template when the word template is constructed.

[0081] In order to facilitate the user to configure the character length through the client, the client can also provide a character length configuration interface for the user to configure the character length, as shown in Figure 6 The user can configure the character length required by the post, space and name respectively through the input operation to the specified input box in the character length configuration interface, so that the client can obtain the configured character length from the input data of the input box and provide it to the server for calculation.

[0082] In order to facilitate the developer to configure the JS function through the server, the function configuration interface can be provided through the background management system of the document center for the developer to configure the JS function, as shown in Figure 7 The developer can configure the function name, function type, function content, function description, etc. of the JS function in the function configuration interface.

[0083] To facilitate the user to set the JS function through the client, the client can also provide a function parameter setting interface and a function source code setting interface respectively for the user to perform function parameter setting operation and function source code setting operation of the JS function, see Figure 8 and Figure 9 As shown, the user can set the function parameters and the function source code of the JS function in the function parameter setting interface and the function source code setting interface respectively.

[0084] For example, Figure 5 The source code part of the JS function corresponding to the "current date" in the above example is &<26, common_data.commen_curDate>, where 26 is the function id. The client can use the function id to obtain the function content with the function id in the document center service for calculation and fill the function calculation result to the corresponding position of the document template, Figure 7 As shown, the function configuration interface provided by the document center background management system presents the JS function content, Figure 8 and Figure 9 As shown, the function parameter setting interface and the function source code setting interface provided by the word plug-in of the client are respectively shown.

[0085] Court legal documents often need to consider the following requirements:

[0086] (1) Format consistency: Regardless of the length of the names involved, it is necessary to ensure that the layout of the signature part of all legal documents remains highly consistent.

[0087] (2) Information accuracy: Ensure the accuracy of each position and corresponding name, as well as the correct conversion and formatting of dates.

[0088] (3) Response speed: The algorithm needs to be efficient, even when faced with a large number of documents or extremely long names, it can quickly complete the format adjustment.

[0089] (4) Compatibility: It can adapt to different types of legal document format requirements, including but not limited to judgment, ruling, mediation, etc.

[0090] (5) User-friendly: Provide a simple operation interface, so that non-technical legal workers can also use it easily.

[0091] However, the traditional document signature layout method is complicated to operate and has low accuracy and efficiency, which is difficult to meet the above requirements. By using the above document signature layout method, the use of the word template engine can realize the related configuration of conditions, rules, etc. through the configuration of EL expressions, etc. to improve the calculation efficiency of the document signature layout; Because it also combines the JS engine, it can be dynamically configured by configuring JS functions to calculate the output content required to improve the calculation efficiency of the document signature layout.

[0092] In addition, the above document signature layout method can also realize the following functions:

[0093] 1) Intelligent algorithm optimization: Introduce dynamic programming algorithm to optimize string filling (i.e. add half-space expansion) strategy, reduce unnecessary calculation, and improve processing speed.

[0094] Intelligent algorithm optimization mainly includes:

[0095] 1.1) Problem decomposition: Decompose the string filling task into processing of individual strings. Each string needs to calculate how to add spaces to meet the width requirement according to the difference between its actual length and the target display width, while considering visual alignment and aesthetics.

[0096] 1.2) Overlapping sub-problem identification: When processing multiple strings, similar filling requirements may be encountered (such as multiple strings needing to be filled to the same width), which can be avoided by recording previously processed strings and their corresponding optimal filling schemes to avoid repeated calculation.

[0097] 1.3) Optimal substructure design: When designing the algorithm, ensure that each filling decision is locally optimal, so as to accumulate a globally optimal solution. For example, for the requirement of fixed character width (such as "clerk" needs to be displayed as 5 characters wide), it can be regarded as a sub-problem, and its optimal solution is to evenly distribute spaces.

[0098] 1.4) Memory design (i.e. cache design): Establish a cache to store strings that have been calculated and their optimal filling results under different widths. When encountering the same or similar strings, directly read the results from the cache to avoid repeated processing.

[0099] The specific improvement strategies of intelligent algorithm optimization can include initialization, recursive relationship, state transition, and decision selection.

[0100] Wherein, the initialization refers to: constructing a cache table or dictionary, the key is a string and its target width, and the value is the optimal padding string under the condition. The recurrence relation refers to: for each string, starting from the shortest display width, gradually trying to increase the width, and calculating the optimal padding method under each width. If the same or similar situation has been processed (by comparing the string content), the result is directly obtained from the cache. The state transition refers to: when padding the string, according to the current string length and the target width, it is decided whether to evenly distribute spaces inside the string (in the case of fixed character width) or to add spaces at the end of the string (in the case of non-fixed character width), and the optimal solution in this process is recorded. Decision selection refers to: when processing multiple strings containing multiple width requirements, make padding decisions quickly according to the existing cache information, and prefer to reuse previous calculation results.

[0101] 2) User interaction optimization: increase the visual configuration interface, users can intuitively set the alignment rules, and the system automatically applies to all documents.

[0102] In extreme cases, such as the processing of very long names or special characters, there may still be problems with the alignment of the document seal, and the algorithm logic can be further refined to ensure that the document seal format is beautiful in any case. For example, for the case where the font size exceeds the line length of the word page, the client system can provide the user with a switch to change the font size or directly generate and display an error prompt when the font size exceeds the line length of the word page. For example, for the case of seal configuration in the header and footer, the client can directly disable the configuration of the seal in the page footer to avoid this situation, and the client can also directly generate and display an error prompt when the seal is configured in the header and footer.

[0103] Further, the above document seal layout method can also implement the following more functions:

[0104] (1) Exception handling mechanism: For very long names or special characters, design exception handling strategies, such as limiting the display length of the name and providing a note for the complete name, or escaping special characters.

[0105] The exception handling mechanism can include the following aspects:

[0106] 1. Very long name processing, including its execution content, execution time and execution method:

[0107] Execution content: Set the maximum display length of the name, and truncate the name that exceeds this length, and provide a way to view the complete name.

[0108] Execution time: Perform name length check when obtaining name data and preparing to fill in the document or interface.

[0109] Execution:

[0110] (1) Truncate display: If the name exceeds 20 characters, replace the part of the name with ellipsis "..." instead.

[0111] (2) Provide full name view: Provide a way to view the full name in the document or interface, such as under the name or a mouse-over tooltip.

[0112] (3) Interactive prompt: Prompt the user through the UI that the name has been truncated and provide a link or button to view the full name.

[0113] 2. Special character processing, including its execution content, execution timing and execution method:

[0114] Execution content: Identify and process special characters that may cause display errors or formatting confusion, such as control characters, mixed full-width and half-width characters, illegal Unicode characters, etc.

[0115] Execution timing: Special character checking is performed during data input validation and before filling in the template.

[0116] Execution method:

[0117] (1) Escape or filter: Convert special control characters to visible characters or remove them directly to ensure correct output results.

[0118] (2) Uniform character encoding: Automatically convert full-width characters to half-width characters, or convert to a unified character set according to document standards (such as full conversion to UTF-8).

[0119] (3) Prompt and correction: When encountering special characters that cannot be directly processed, provide clear error prompts to the user and suggest or automatically correct them to acceptable characters.

[0120] 3. Cultural sensitivity processing, including its execution content, execution timing and execution method:

[0121] Execution content: Respect cultural elements in names, such as hyphens, honorifics, order of surnames and given names, etc.

[0122] Execution timing: Cultural sensitivity should be considered at any time when processing and displaying names.

[0123] Execution method:

[0124] (1) Preserve format: Ensure that the system supports and correctly processes hyphens, spaces, etc. in names, such as the double surname phenomenon in Spanish.

[0125] (2) Provide options: allow users to customize the display format of names, especially for international users, provide the choice of putting the surname first or last.

[0126] 4. Technical compatibility processing, including its execution content, execution timing and execution method:

[0127] Execution content: Ensure the compatibility and correct display of names in different systems, software or fonts.

[0128] Execution timing: Considered when designing document templates and selecting fonts, and tested when outputting to different formats (such as PDF, Word).

[0129] Execution method:

[0130] (1) Font selection and testing: Select fonts that widely support multilingual character sets and conduct cross-platform and cross-software compatibility testing.

[0131] (2) Encoding standardization: Ensure the use of uniform and widely used character encoding standards such as UTF-8 throughout the entire processing flow.

[0132] (3) Error logging: Log detailed information for incorrectly displayed names, including character encoding, used fonts and software versions, etc., for subsequent analysis and repair.

[0133] (II) Performance monitoring and feedback loop: Establish a performance monitoring system, collect user feedback, and continuously iterate and optimize the algorithm to ensure optimal results in various scenarios.

[0134] Based on the above document signature layout method, the embodiments of the present application also provide a document signature layout device, as shown in Figure 10 The device can include the following modules:

[0135] The first acquisition module 101 is configured to acquire the key information of the document signature; wherein the key information includes the post and name of the role variable contained in the document signature and the date contained in the document signature.

[0136] The second acquisition module 102 is configured to acquire the field length configuration information corresponding to the key information; wherein the field length configuration information includes the first field length corresponding to the post and name respectively and the second field length corresponding to the space between the post and name which are pre-configured.

[0137] The determining module 103 is configured to determine actual text lengths corresponding to the positions, the names, and the date respectively, and determine space filling information corresponding to the key information based on the field length configuration information and the actual text lengths. The space filling information includes a number of spaces filled and a space filling manner corresponding to each of the positions, the names, and the date.

[0138] The space filling and rendering module 104 is configured to fill spaces for the key information based on the space filling information, and render the document signature based on filled information obtained after the spaces are filled to obtain a layout result of the document signature.

[0139] The determining module 103 can also be configured to count a first number of characters occupied by text corresponding to each of the positions, and determine the first number of characters as a first actual text length corresponding to the positions; count a second number of characters occupied by text corresponding to each of the names, and determine the second number of characters as a second actual text length corresponding to the names; convert the date into a date text in Chinese uppercase form, count a third number of characters occupied by the date text, and determine the third number of characters as a third actual text length corresponding to the date.

[0140] The determining module 103 can also be configured to determine first space filling information corresponding to the positions based on a first field length corresponding to the positions and the first actual text length; the first space filling information includes a first number of spaces filled and a first space filling manner corresponding to each of the positions; determine second space filling information corresponding to the names based on a second field length corresponding to the names and the second actual text length; the second space filling information includes a second number of spaces filled and a second space filling manner corresponding to each of the names; and determine third space filling information corresponding to the date based on the first field length, the second field length, and the third actual text length; the third space filling information includes a third number of spaces filled and a third space filling manner corresponding to the date.

[0141] The determining module 103 can also be configured to determine a third field length corresponding to the date text based on the first field length and the second field length; the third field length represents a sum of a maximum value of the first field length corresponding to the positions, a maximum value of the first field length corresponding to the names, and the second field length; and determine the third space filling information based on the third field length.

[0142] The filling rendering module 104 can also be configured to fill spaces for each position based on the first number of spaces to fill and the first space filling manner corresponding to each position, to obtain filled position information corresponding to each position; fill spaces for each name based on the second number of spaces to fill and the second space filling manner corresponding to each name, to obtain filled name information corresponding to each name; and fill spaces for the date based on the third number of spaces to fill and the third space filling manner corresponding to the date, to obtain filled date information corresponding to the date.

[0143] The filling rendering module 104 can also be configured to render the filled position information, the filled name information and the filled date information by using a template engine corresponding to the document, and take the rendered result as the layout result.

[0144] The first obtaining module 101 can also be configured to perform text analysis on the document, and obtain a keyword corresponding to a preset template by a regular matching manner, wherein the keyword includes a first keyword corresponding to a role variable and a second keyword corresponding to a date; obtain a position and a name of the role variable based on the first keyword; and obtain original date data corresponding to the date based on the second keyword, and calculate the date by using a JS engine corresponding to the date and the original date data.

[0145] Referring to FIG. 1, Figure 10 The device can include:

[0146] The configuration module 105 is configured to provide a field length configuration interface for a user to configure the first field length and the second field length.

[0147] The second obtaining module 102 can also be configured to obtain the field length configured by the user as the field length configuration information.

[0148] The document signature layout device provided in the embodiment of the present application has the same implementation principle and technical effects as the aforementioned document signature layout method embodiment, and for brevity of description, the part of the device embodiment not mentioned can be referred to the corresponding content in the aforementioned method embodiment.

[0149] The embodiment of the present application further provides an electronic device, as shown in Figure 11 The electronic device includes a processor 111 and a memory 110, the memory 110 stores computer executable instructions capable of being executed by the processor 111, and the processor 111 executes the computer executable instructions to implement the aforementioned document signature layout method.

[0150] In Figure 11In the illustrated embodiment, the electronic device further comprises a bus 112 and a communication interface 113, wherein the processor 111, the communication interface 113 and the memory 110 are connected through the bus 112.

[0151] The memory 110 can contain a high-speed random access memory (RAM) and can also include a non-volatile memory, such as at least one disk memory. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 113 (which can be wired or wireless), and the Internet, a wide area network, a local area network, a metropolitan area network, etc. can be used. The bus 112 can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus, or an EISA (Extended Industry Standard Architecture) bus, etc. The bus 112 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 11 Only one bidirectional arrow is used in the figure to represent only one bus or one type of bus.

[0152] The processor 111 can be an integrated circuit chip with a processing capability of signals. In the implementation process, each step of the above method can be completed by the integrated logic circuit of hardware in the processor 111 or the instruction in the form of software. The processor 111 described above can be a general processor, including a central processing unit (CPU), a network processor (NP), etc.; can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. The general processor can be a microprocessor or the processor can also be any conventional processor. The steps of the method disclosed in combination with the embodiments of the application can be directly embodied as a hardware decoding processor for execution, or a combination of hardware and software modules in the decoding processor for execution. The software module can be located in a random access memory, a flash memory, a read only memory, a programmable read only memory or an electrically erasable programmable memory, a register, etc. The storage medium in the art. The storage medium is located in the memory, and the processor 111 reads the information in the memory, and combines the hardware to complete the steps of the document seal layout method of the above embodiment.

[0153] Unless specifically stated otherwise, the relative steps, numerical expressions, and numerical values of the components and steps set forth in these embodiments do not limit the scope of the application.

[0154] If the function is realized in the form of a software function unit and sold or used as an independent product, it can be stored in a non-volatile computer readable storage medium executable by a processor. Based on this understanding, the technical solutions of the application essentially or the part that contributes to the prior art or part of the technical solutions can be embodied in the form of a software product, which is stored in a storage medium and includes a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the application. The foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and various program code storage media.

[0155] In the description of the present application, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer" and the like indicate the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present application and simplifying the description, and do not indicate or imply that the device or element referred to must have a particular orientation, be constructed and operated in a particular orientation, and therefore cannot be understood as a limitation on the present application. In addition, the terms "first", "second", "third" are only for the purpose of description, and cannot be understood as indicating or implying relative importance.

[0156] Finally, it should be noted that the above-described embodiments are only specific embodiments of the present application, which are used to illustrate the technical solutions of the present application, and are not limiting. The protection scope of the present application is not limited thereto. Although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can make modifications or easily think of changes to the technical solutions recorded in the foregoing embodiments within the technical range disclosed by the present application, or make equivalent replacements to some technical features; and these modifications, changes or replacements do not cause the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be covered within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.

Claims

1. A method of lettering and signing a document, characterized in that, The method comprises: obtaining key information of a document seal; wherein the key information comprises a post and a name of a role variable contained in the document seal and a date contained in the document seal; the document adopts a word file; obtaining field length configuration information corresponding to the key information; wherein the field length configuration information comprises a first field length corresponding to each of the post and the name and a second field length corresponding to a space between the post and the name which are pre-configured; determining actual text lengths corresponding to the post, the name and the date respectively, and determining space filling information corresponding to the key information based on the field length configuration information and the actual text lengths; wherein the space filling information comprises a space filling number and a space filling mode corresponding to each of the post, the name and the date; filling spaces for the key information based on the space filling information, rendering filled post information, filled name information and filled date information obtained after the spaces are filled by using a word template engine corresponding to the document, and taking a result after the rendering as a layout result of the document seal; determining actual text lengths corresponding to the post, the name and the date respectively comprises: counting a first character number of text corresponding to each post and determining the obtained first character number as a first actual text length corresponding to the post; counting a second character number of text corresponding to each name and determining the obtained second character number as a second actual text length corresponding to the name; converting the date into a date text in Chinese capital form, counting a third character number of the date text, and determining the obtained third character number as a third actual text length corresponding to the date; determining space filling information corresponding to the key information based on the field length configuration information and the actual text lengths comprises: determining first space filling information corresponding to the post based on the first field length corresponding to the post and the first actual text length; wherein the first space filling information comprises a first space filling number and a first space filling mode corresponding to each post; determining second space filling information corresponding to the name based on the first field length corresponding to the name and the second actual text length; wherein the second space filling information comprises a second space filling number and a second space filling mode corresponding to each name; determining a third field length corresponding to the date text based on the first field length and the second field length; wherein the third field length is determined by calculating a sum of a maximum value of the first field length corresponding to the post, a maximum value of the first field length corresponding to the name and the second field length; and determining third space filling information corresponding to the date based on the third field length; wherein the third space filling information comprises a third space filling number and a third space filling mode corresponding to the date. The method comprises the following steps: filling spaces for the key information based on the space filling information, which comprises: filling spaces for each post based on the first space filling number and the first space filling mode corresponding to each post to obtain filled post information corresponding to each post; filling spaces for each name based on the second space filling number and the second space filling mode corresponding to each name to obtain filled name information corresponding to each name; filling spaces for the date based on the third space filling number and the third space filling mode corresponding to the date to obtain filled date information corresponding to the date; The method comprises the following steps: obtaining key information of a document signature, which comprises: performing text analysis on the document, and obtaining a keyword corresponding to a preset template from the document signature by using a regular expression for regular matching; wherein the keyword comprises a first keyword corresponding to a role variable and a second keyword corresponding to a date; extracting content corresponding to a first position in the preset template from the document signature as a post of the role variable by using the first keyword, and extracting content corresponding to a second position in the preset template from the document signature as a name of the role variable; extracting content corresponding to a third position in the preset template from the document signature as original date data corresponding to the date by using the second keyword, and calculating the date by using a JS function for calculating the date through a JS engine corresponding to the date; wherein the preset template is a word template; Before obtaining the field length configuration information corresponding to the key information, the method further comprises: providing a field length configuration interface for a user to configure the first field length and the second field length; Obtaining the field length configuration information corresponding to the key information comprises: obtaining a field length configured by the user as the field length configuration information.

2. A document signing layout apparatus, characterized by comprising: The device comprises: The first obtaining module is configured to obtain key information of a document signature; wherein the key information comprises a post and a name of a role variable contained in the document signature, and a date contained in the document signature; the document is in a word file; The second obtaining module is configured to obtain field length configuration information corresponding to the key information; wherein the field length configuration information comprises a first field length corresponding to each of the post and the name, and a second field length corresponding to a space between the post and the name; The determining module is configured to determine actual text lengths corresponding to the post, the name and the date respectively, and determine space filling information corresponding to the key information based on the field length configuration information and the actual text lengths; wherein the space filling information comprises a space filling number and a space filling mode corresponding to each of the post, the name and the date; The filling and rendering module is configured to fill spaces for the key information based on the space filling information, and render filled post information, filled name information and filled date information obtained after the spaces are filled by using a word template engine corresponding to the document, and take a result after the rendering as a layout result of the document signature. The determining module is further configured to: count a first character number of text corresponding to each post, and determine the obtained first character number as a first actual text length corresponding to the post; count a second character number of text corresponding to each name, and determine the obtained second character number as a second actual text length corresponding to the name; convert the date into a date text in Chinese capital form, count a third character number of the date text, and determine the obtained third character number as a third actual text length corresponding to the date; The determining module is further configured to: determine first space filling information corresponding to the post based on the first field length and the first actual text length corresponding to the post; wherein the first space filling information includes a first space filling number and a first space filling mode corresponding to each post; determine second space filling information corresponding to the name based on the first field length and the second actual text length corresponding to the name; wherein the second space filling information includes a second space filling number and a second space filling mode corresponding to each name; determine a third field length corresponding to the date text based on the first field length and the second field length; wherein the third field length is determined by calculating a sum of a maximum value of the first field length corresponding to the post, a maximum value of the first field length corresponding to the name, and the second field length; and determine third space filling information corresponding to the date based on the third field length; wherein the third space filling information includes a third space filling number and a third space filling mode corresponding to the date; The filling and rendering module is further configured to: fill spaces for each post based on the first space filling number and the first space filling mode corresponding to each post, to obtain filled post information corresponding to each post; fill spaces for each name based on the second space filling number and the second space filling mode corresponding to each name, to obtain filled name information corresponding to each name; and fill spaces for the date based on the third space filling number and the third space filling mode corresponding to the date, to obtain filled date information corresponding to the date. The first obtaining module is further configured to: perform text analysis on the document, and obtain a keyword corresponding to a preset template from a document seal by using a regular expression for regular matching; wherein the keyword includes a first keyword corresponding to a role variable and a second keyword corresponding to the date; extract, by using the first keyword, content corresponding to a first position in the preset template from the document seal as a post of the role variable, and extract content corresponding to a second position in the preset template from the document seal as a name of the role variable; extract, by using the second keyword, content corresponding to a third position in the preset template from the document seal as original date data corresponding to the date, and calculate the date by using a JS function for calculating the date through a JS engine corresponding to the date; wherein the preset template is a word template. The apparatus further includes a configuration module configured to provide a field length configuration interface for a user to configure the first field length and the second field length. The second obtaining module is further configured to obtain the field length configured by the user as the field length configuration information.

3. An electronic device, comprising: A processor and a memory, the memory stores computer executable instructions capable of being executed by the processor, and the processor executes the computer executable instructions to implement the method in claim 1.

Citation Information

Patent Citations

  • Typesetting method for implementing multiple alignment in word rows

    CN101196875A

  • Document processing method and device, computer equipment and storage medium

    CN116776850A