A method for quickly copying forms based on a browser plug-in
By automatically recognizing and matching webpage table data through a browser plugin, the cumbersome and inefficient traditional copy-and-paste method is solved, enabling efficient and accurate copying of table data. It is compatible with multiple browsers and table formats, improving the user experience.
Patent Information
- Application Number
- CN202511608704.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-05
- Publication Date
- 2026-02-10
- Estimated Expiration
- 2045-11-05
AI Technical Summary
In existing technologies, copying and pasting data from webpage tables is cumbersome, inefficient, and prone to errors, especially with large amounts of data, which is time-consuming and laborious, and data omissions or misalignments are likely to occur.
It employs a browser plugin-based method for quickly copying forms, automatically identifies and highlights table areas using DOM parsing technology, extracts structured data, and automatically matches and populates data on the target webpage. It supports multiple browsers and table formats and provides data validation and adjustment functions.
It greatly simplifies the operation process, improves the efficiency and accuracy of data copying, adapts to different browsers and table formats, reduces human error, and is especially suitable for users who frequently process table data.
Smart Images

Figure CN121070650B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of digital information processing technology, specifically to a method for quickly copying forms based on a browser plugin, aiming to solve the problem of users quickly and accurately copying data from one webpage table to another in their daily webpage operations. Background Technology
[0002] In their daily work, users often encounter situations where they need to copy table data from webpage A to a table on webpage B. For example, finance personnel may need to integrate data from one system into a table from another system when processing report data exported from different financial systems; data analysts also need to perform similar table data copying operations when collecting and organizing data from multiple webpages.
[0003] However, the traditional method currently involves manual copying and pasting. Users need to first select the data in table A on webpage A, copy it, then switch to webpage B, locate the corresponding table, and paste it. This method has many drawbacks: the process is cumbersome, requiring multiple page switching and mouse / keyboard operations; it is inefficient, especially when dealing with large amounts of data, as the copy-paste process can be very time-consuming; and it is prone to errors, as data omissions or misalignments may occur during manual selection and pasting, leading to inaccurate data. Summary of the Invention
[0004] The purpose of this invention is to provide a fast form copying method based on a browser plugin, so as to solve the problems of cumbersome, inefficient and error-prone manual copying and pasting of web page table data in the prior art, thereby achieving fast, accurate and convenient copying of web page table data.
[0005] The present invention achieves the above objectives through the following technical solutions:
[0006] A method for quickly copying forms based on a browser plugin includes the following steps:
[0007] Plugin installation and activation steps: Complete the installation and activation of the Chrome plugin in the client browser environment;
[0008] Data source selection steps: Open the first webpage and select the table data area to be copied through interactive operations. The Chrome plugin uses DOM parsing technology to parse the webpage content, identify the selectable table area and highlight it.
[0009] Data extraction steps: Trigger the extraction function of the Chrome plugin, extract the data in the selected table area through the Chrome plugin, and convert the extracted data into a structured data format;
[0010] Steps to locate the target page: Open the second webpage and locate the table area where you need to paste the data. The Chrome extension uses DOM parsing technology to parse the content of the target webpage and identify the target table.
[0011] Data matching and filling steps: The Chrome extension automatically matches the extracted structured data with the column names of the target table, and automatically fills the data into the corresponding cells of the target table according to the matching results;
[0012] Data validation and adjustment steps: Validate the data filled into the target table and adjust it according to the validation results.
[0013] According to the present invention, a method for quickly copying forms based on a browser plugin is provided. In the plugin installation and activation steps, when the client browser triggers a plugin installation request, it resolves the server domain name through a preset protocol packet name and obtains plugin configuration data in JSON array format from the server Redis cache. The configuration data includes at least the plugin identifier, target operating system type, browser kernel type, installation condition rules, and activation dependencies.
[0014] If the current system time is detected to be within the preset plugin configuration update cycle, a data acquisition request will be forcibly triggered, and the data integrity will be verified.
[0015] Obtain the client's first operating system type, first browser kernel version, and list of installed plugins. Compare the first operating system type with the second operating system type in the plugin configuration data. Cross-validate the first browser kernel version with the second kernel version in the configuration data.
[0016] If the comparison results are consistent, the system will further verify whether there is a similar plugin that conflicts with the target plugin in the list of installed plugins. If so, a conflict warning will be generated and the activation process will be terminated.
[0017] According to the present invention, a method for quickly copying forms based on browser plugins is provided, which calls the corresponding installation condition rule engine according to the plugin type, including the following steps:
[0018] For ActiveX plugins that require binding to the system registry, verify whether the client has administrator privileges and check whether the target CLSID exists in the registry path;
[0019] For PPAPI / NPAPI plugins, verify that the browser plugin directory contains the plugin file of the specified version, and verify that the file hash value matches the checksum in the configuration data;
[0020] If the verification passes, a temporary activation token is generated and stored in the client's local cache;
[0021] An activation verification request is sent to the server based on the temporary activation token. The server returns an activation script containing dynamic parameters, which is then parsed by the browser's extension manager.
[0022] According to the present invention, a method for quickly copying forms based on a browser plugin is provided. In the data source selection step, when the first webpage is opened through the client browser, the plugin's background script is automatically injected into the webpage's header tag to listen for whether the page has completed loading the HTML document and constructing the DOM tree.
[0023] The plugin extension manager calls the Chrome extension development interface provided by the browser to inject the first initialization script into the current tab. The first initialization script includes the following functional modules:
[0024] First DOM parsing engine: Parses webpage structure based on the Document Object Model standard and generates a node tree model;
[0025] Region identification module: Traverses all table container tags using XML path language or CSS selectors;
[0026] First rendering control module: Interacts with the browser rendering engine to obtain the coordinate position and visual status of each table area;
[0027] The Chrome extension generates a semi-transparent floating toolbar at the top of the page, containing a button to select the data source. Clicking this button triggers the following action:
[0028] The Chrome extension iterates through all identified table areas and retrieves their border styles using a global function that is used to get the current calculated style of an element.
[0029] Dynamically add CSS class names to each table area;
[0030] If the table area has a nested structure, only the outermost container is marked.
[0031] According to the present invention, a method for quickly copying forms based on a browser plugin is provided. The plugin listens for mouse events, and when the user hovers the mouse over a marked area:
[0032] Trigger the mouse hover event and change the CSS class name of the current area to data-hover;
[0033] When a mouse click event is triggered, record the following information about the selected area:
[0034] DOM path: Generates a complete XPath from the parent node to the target node by retrieving all node attribute events;
[0035] Row and column range: Parse and label count to determine the starting row / column index and total number of rows / columns of the table;
[0036] Data Snapshot: Uses attribute events to get or set the HTML content inside an element to get the HTML string of the current area and store it in the plugin's local cache.
[0037] According to the present invention, a method for quickly copying forms based on a browser plugin is provided. In the data extraction step, when the extract data button in the plugin toolbar is clicked or the extraction command is triggered by a shortcut key, the plugin background script performs the following operations:
[0038] Call the Chrome extension development interface provided by the browser to send an extraction request containing the selected region identifier to the extension backend;
[0039] The backend server obtains the ID of the currently active tab using the chrome.tabs.query function and injects the data extraction script into the target webpage context.
[0040] The Chrome extension performs the following extraction operations based on the recorded selected area information:
[0041] Header parsing: Iterate through the labels within the selected area, extract the header text, and construct an array of field names named headers;
[0042] Cell positioning: Locate all nodes using functions that query DOM nodes via XPath, mapping them to a two-dimensional array by row and column indices;
[0043] Perform data cleaning processing on the content of each cell, including text normalization, numerical conversion, date standardization, and handling of blank values;
[0044] The Chrome extension converts the cleaned data into structured data.
[0045] According to the method for quickly copying forms based on a browser plugin provided by the present invention, in the target page locating step, when the user opens a second webpage through the client browser, the plugin's background script automatically performs the following operations:
[0046] Page state monitoring: Monitor changes in the DOM structure of the target webpage through the MutationObserver API to ensure that the positioning operation is performed only after the HTML document has been fully loaded and the DOM tree has been built.
[0047] Plugin script injection: This involves calling the browser's `chrome.scripting.executeScript` interface to inject a location initialization script into the target webpage. This script includes the following functional modules:
[0048] Second DOM parsing engine: Parses the webpage structure based on the Document Object Model standard and generates a node tree model;
[0049] Area positioning module: Identifies the target table area using a preset positioning strategy;
[0050] The second rendering control module interacts with the browser rendering engine to obtain the coordinate position, visual status, and hierarchical relationship of the target table.
[0051] The Chrome extension selects one or more location strategies—based on unique identifiers, based on user configuration, or based on table features—to execute, depending on user configuration or automatic detection results.
[0052] For the extracted structured data field names, calculate the Levenshtein distance with the header text of all tables on the webpage, and select the table with the highest similarity as the target table.
[0053] According to the present invention, a method for quickly copying forms based on a browser plugin is provided. The Chrome plugin performs the following compatibility checks and fault tolerance processing on the target form:
[0054] Verify that the number of rows and columns in the target table matches the structured data extracted in the data extraction step;
[0055] If a mismatch is found, a warning message will be generated, and options to force paste or cancel the operation will be provided.
[0056] The target table's DOM changes are continuously monitored by a change observer. If a content update is detected, the positioning strategy is re-executed and the highlight is updated. Timed polling is set to ensure accurate positioning in web pages that load data asynchronously.
[0057] If the second webpage and the data extraction page are from different sources, cross-domain access permissions are obtained through the postMessage mechanism or browser extended permissions.
[0058] If permission acquisition fails, the user is prompted that cross-domain access needs to be authorized to locate the target table, and a link to the permission settings page is provided.
[0059] According to the present invention, a method for quickly copying forms based on a browser plugin is provided. In the data matching and filling step, the Chrome plugin performs unified preprocessing on the extracted structured data field names and target table column names. The preprocessing includes at least text normalization, semantic expansion, word segmentation and weight calculation.
[0060] The Chrome extension uses a combination of the following strategies to match target table columns based on the pre-processed field names:
[0061] Exact match: If the structured data field name is exactly the same as the target table column name, a mapping relationship is established directly; for columns containing unique identifiers, exact match is performed first.
[0062] Fuzzy matching: An improved Levenshtein distance algorithm is used, combined with word segmentation weights to calculate field similarity, expressed as:
[0063]
[0064] in, t i Tokenize structured fields. c i Segment the target column. w i For word segmentation weights, match( t i , c i () represents the result of a binary matching.
[0065] If the similarity is greater than or equal to the set threshold, then a mapping relationship is established;
[0066] If multiple target columns match the same structured field, the column with the highest similarity is selected, and a conflict log is recorded for user verification.
[0067] For columns that cannot be directly matched by field name, analyze the contents of other columns in the same row and use a pre-built business rule library to assist in matching.
[0068] According to the present invention, a method for quickly copying forms based on a browser plugin is provided. Based on the matching results, the Chrome plugin populates structured data into the target table according to the following rules:
[0069] Single-column fill: For columns with exact matches or high similarity matches, directly fill the target column with the values of the corresponding fields from the structured data; data type is preserved during the fill process;
[0070] Multi-column fill: If the target table needs to be split into structured fields, the sub-fields are extracted and filled according to the preset splitting rules; for merged fill scenarios, the fields are concatenated and filled according to the specified format.
[0071] Dynamically adapt and fill: If the number of target columns is greater than the number of structured fields, fill the remaining columns with default values; if the number of target columns is less than the number of structured fields, generate a warning message and provide options to truncate or skip filling.
[0072] Therefore, compared with the existing technology, the fast form copying method based on browser plugin proposed in this invention has the following beneficial effects:
[0073] 1. In daily web page table data processing, the traditional manual copy-and-paste method is cumbersome. Users need to switch pages multiple times and accurately select data areas and execute copy and paste commands between different pages. This process is prone to errors and is time-consuming and laborious. This invention, however, simplifies this complex process significantly through a browser plugin. Users only need to install and activate the plugin in their browser. Then, on web page A where data needs to be copied, the plugin's DOM parsing technology allows for quick selection of the target table data. The plugin automatically highlights the operable areas, and the user can click the plugin button to complete the data extraction. Next, the user opens web page B and locates the target table. The plugin again identifies the target table through DOM parsing and automatically matches and populates the extracted data with the target table's column names. Throughout the entire process, users only need to perform a few simple mouse clicks, eliminating the need for manual selection, copying, and pasting of data. This greatly saves time and effort, making it particularly suitable for users who frequently need to copy table data, such as finance personnel processing large amounts of financial statement data daily, and data analysts collecting and organizing data from multiple web pages. This effectively improves overall work efficiency.
[0074] 2. When manually copying and pasting table data, human factors such as visual fatigue and operational errors often lead to data omissions and misalignments, resulting in inaccurate copied data and affecting subsequent data analysis and decision-making. This invention uses a plugin to automatically identify and match data, fundamentally avoiding these human errors. The plugin utilizes advanced DOM parsing technology to accurately identify the table structure and data content in the webpage and convert it into a structured data format (such as JSON). This format can completely preserve the column names and cell information of the table data. During the data filling stage, the plugin precisely matches the column names of the extracted data with the column names of the target table, ensuring that each piece of data is accurately filled into the corresponding cell. Even if there are differences in column names between the data source table and the target table, the data mapping function provided by the plugin allows users to customize the column name correspondence, further ensuring the accuracy of data filling. Through these technical means, this invention effectively improves the accuracy of data copying and provides users with reliable data support.
[0075] 3. Different users may use different types of browsers, such as Chrome, Firefox, and Edge, and the table formats from which the data originates are also diverse, including HTML tables and Excel spreadsheets. Traditional copy-paste methods often cannot adapt well to these differences, potentially leading to compatibility issues, resulting in inability to copy correctly or incorrect data formats. The plugin of this invention boasts strong versatility and compatibility. It supports multiple mainstream browsers and can run stably in different browser environments, providing users with a consistent and fast copying experience. Furthermore, the plugin can recognize and extract data from various table formats, accurately processing both HTML tables from web pages and Excel spreadsheets exported through other means. This allows the invention to meet the usage requirements of different users in different work environments and needs. Whether in a corporate office environment or in personal learning and research scenarios, it can leverage its advantages to provide users with a convenient and efficient table data copying solution.
[0076] The present invention will now be described in further detail with reference to the accompanying drawings and specific embodiments. Attached Figure Description
[0077] Figure 1 This is a flowchart of an embodiment of a method for quickly copying forms based on a browser plugin according to the present invention.
[0078] Figure 2 This is a flowchart illustrating an embodiment of a method for quickly copying forms based on a browser plugin, according to the present invention.
[0079] Figure 3 This is a flowchart of the plugin installation and activation steps in an embodiment of a method for quickly copying forms based on a browser plugin according to the present invention.
[0080] Figure 4 This is a flowchart illustrating the process of calling the corresponding installation condition rule engine based on the plugin type in an embodiment of a method for quickly copying forms based on browser plugins according to the present invention.
[0081] Figure 5 This is a schematic diagram of the first initialization script in an embodiment of a method for quickly copying forms based on a browser plugin according to the present invention.
[0082] Figure 6 This is a flowchart of the data extraction steps in an embodiment of a method for quickly copying forms based on a browser plugin according to the present invention.
[0083] Figure 7 This is a schematic diagram illustrating the principle of locating the initialization script in an embodiment of a method for quickly copying forms based on a browser plugin according to the present invention.
[0084] Figure 8 This is a flowchart illustrating the adaptation check and fault tolerance processing performed by the Chrome plugin on the target table in an embodiment of a method for quickly copying forms based on a browser plugin according to the present invention.
[0085] Figure 9 This is a flowchart illustrating how a Chrome plugin populates structured data into a target table, as described in an embodiment of a method for quickly copying forms based on a browser plugin according to the present invention. Detailed Implementation
[0086] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0087] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0088] See Figures 1 to 9 This embodiment provides a method for quickly copying forms based on a browser plugin, including:
[0089] Plugin Installation and Activation Steps - S1: Complete the installation and activation of the Chrome plugin in the client browser environment;
[0090] Data source selection step - S2: Open the first webpage and select the table data area to be copied through interactive operation. The Chrome plugin uses DOM parsing technology to parse the webpage content, identify the selectable table area and highlight it.
[0091] Data extraction step - S3: Trigger the extraction function of the Chrome plugin to extract data from the selected table area and convert the extracted data into a structured data format;
[0092] Target page location step - S4: Open the second webpage and locate the table area where you need to paste the data. The Chrome plugin uses DOM parsing technology to parse the content of the target webpage and identify the target table.
[0093] Data matching and filling step - S5: The Chrome plugin automatically matches the extracted structured data with the column names of the target table, and automatically fills the data into the corresponding cells of the target table according to the matching results;
[0094] Data Validation and Adjustment Steps - S6: Validate the data populated into the target table and adjust it based on the validation results.
[0095] like Figure 3 As shown, in the plugin installation and activation steps, when the client browser triggers a plugin installation request, it resolves the server domain name through a preset protocol packet name and retrieves the plugin configuration data from the server Redis cache in JSON array format; the configuration data includes at least the plugin identifier, target operating system type, browser kernel type, installation condition rules, and activation dependencies.
[0096] If the current system time is detected to be within the preset plugin configuration update cycle, a data acquisition request will be forcibly triggered, and the data integrity will be verified.
[0097] Obtain the client's first operating system type, first browser kernel version, and list of installed plugins. Compare the first operating system type with the second operating system type in the plugin configuration data. Cross-validate the first browser kernel version with the second kernel version in the configuration data.
[0098] If the comparison results are consistent, the system will further verify whether there is a similar plugin that conflicts with the target plugin in the list of installed plugins. If so, a conflict warning will be generated and the activation process will be terminated.
[0099] In this embodiment, as Figure 4 As shown, the corresponding installation condition rule engine is invoked based on the plugin type, including the following steps:
[0100] For ActiveX plugins that require binding to the system registry, verify whether the client has administrator privileges and check whether the target CLSID exists in the registry path;
[0101] For PPAPI / NPAPI plugins, verify that the browser plugin directory contains the plugin file of the specified version, and verify that the file hash value matches the checksum in the configuration data;
[0102] If the verification passes, a temporary activation token is generated and stored in the client's local cache.
[0103] An activation verification request is sent to the server based on a temporary activation token, and the server returns an activation script containing dynamic parameters.
[0104] In this embodiment, the activation script is parsed through the browser extension manager, and one of the following operations is performed:
[0105] Silent activation mode: Automatically modifies browser homepage settings or new tab configuration, binding the specified URL as the default access entry;
[0106] User interaction mode: A plugin icon is generated in the toolbar on the right side of the browser address bar. Clicking it will bring up a configuration window that requires the user to manually confirm the changes to the homepage settings.
[0107] After successful activation, an activation status feedback packet is sent to the server, which includes at least the client's unique identifier, activation timestamp, and plugin version number.
[0108] In the data source selection step, when the first webpage is opened through the client browser, the plugin's background script is automatically injected into the webpage's header tag to listen for whether the page has completed loading the HTML document and building the DOM tree, i.e., the DOMContentLoaded event.
[0109] The plugin extension manager calls the Chrome extension development interface (chrome.tabs.executeScript interface) provided by the browser to inject the initialization script into the current tab, such as... Figure 5 As shown, the first initialization script includes the following functional modules:
[0110] The first DOM parsing engine parses the webpage structure based on the Document Object Model standard and generates a node tree model;
[0111] Region identification module: Traverses all regions using XML Path Language (XPath) or CSS selectors.
[0112]
[0113]
[0114]
[0115]
[0116] ,<divclass="table-container"> The system includes preset table container tags; the first rendering control module interacts with the browser rendering engine to obtain the coordinates and visibility of each table area. The Chrome plugin generates a semi-transparent floating toolbar at the top of the page, containing a "Select Data Source" button. Clicking this button triggers the following operations: The Chrome plugin iterates through all identified table areas, obtaining their border styles using the global function (window.getComputedStyle()) used to get the element's current computed style; it dynamically adds the CSS class name data-selectable to each table area and sets the style to border: 2px dashed #FF5722; background-color: rgba(255, 235, 59, 0.2); if the table areas have nested structures (such as...), the system will handle the rest. Embedded
[0117]
[0118]
[0119]
[0120]
[0121]
[0125]
[0126]
[0127]
[0128] Figure 6
[0129]
[0130]
[0131]
[0132] If the outermost container is marked, only the outermost container will be marked to avoid duplicate selections. The plugin listens for mouse events. When the user hovers the mouse over the marked area, the following steps are performed: The mouseover event is triggered, the CSS class name of the current area is changed to data-hover, and the style is adjusted to border-color: #4CAF50; background-color: rgba(76, 175, 80, 0.3); When the click event is triggered, the following information about the selected area is recorded: DOM path: A complete XPath from the parent node to the target node is generated by obtaining all node property events of the parent node (element.parentNode.path); Row and column range: Parsed... 、 The number of tags determines the starting row / column index and the total number of rows / columns in the table;
[0122] Data Snapshot: Use the attribute event (element.innerHTML) used to get or set the HTML content inside the element to get the HTML string of the current area and store it in the plugin's local cache.
[0123] In this embodiment, the Chrome plugin performs data validity verification on the selected area, including:
[0124] Structural integrity check: Verify whether a table header is included ( Tags) and data rows (Number of tags ≥ 1); Data type inference: Matches cell content using regular expressions to identify types such as numbers, dates, and text; Empty value detection: Calculates the percentage of empty cells; if it exceeds 30%, a warning message is generated: "The selected area contains a large number of empty values, which may affect the copying quality"; After successful verification, a prompt message "Data in rows X and columns Y has been selected" is displayed in the toolbar, and the confirmation button is highlighted. As shown, in the data extraction step, when the extract data button in the plugin toolbar is clicked or the extraction command is triggered by a shortcut key (such as Ctrl+Shift+E), the plugin background script performs the following operations: Calls the Chrome plugin development interface (chrome.runtime.sendMessage interface) provided by the browser to send an extraction request containing the selected area identifier (such as table-1) to the plugin background; The background service obtains the ID of the currently active tab through the chrome.tabs.query function and injects the data extraction script into the target webpage context. Among them, the Chrome plugin performs the following extraction operations based on the recorded selected area information (XPath / CSS selectors): Table header parsing: Traverses the selected area... Tags, extract the header text and construct an array of field names: headers = ["Product Name", "Price", "Inventory"];
[0133] Cell positioning: Use the document.evaluate function(xpath, document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null) to locate all cells. Nodes are mapped to a two-dimensional array by row and column indices;
[0134] Data cleaning: Perform the following processing on the content of each cell:
[0135] Text normalization: Remove leading and trailing spaces, and unify the newline character to \n;
[0136] Numeric conversion: Identify numbers using the regular expression / \d+\.?\d* / and convert them to Float64 type;
[0137] Date standardization: For strings in the format 2024-05-20 or 05 / 20 / 2024, parse them into Date objects and output them in ISO format (YYYY-MM-DD).
[0138] Null value handling: Replace three or more consecutive spaces or null / undefined with "" (empty string).
[0139] The Chrome extension converts the cleaned data into structured data, such as JSON arrays, CSV strings, and Excel binary streams. The Excel binary stream generates xlsx format files using the SheetJS library, supporting multiple sheets and preserving cell styles.
[0140] During the target page location step, when the user opens the second webpage through the client browser, the plugin's background script automatically performs the following operations:
[0141] Page state monitoring: Monitor changes in the DOM structure of the target webpage through the MutationObserver API to ensure that the positioning operation is performed only after the page is fully loaded (the DOMContentLoaded event is triggered);
[0142] Plugin script injection: This involves calling the browser's `chrome.scripting.executeScript` interface to inject a location initialization script into the target webpage, such as... Figure 7 As shown, the location initialization script includes the following core modules:
[0143] The second DOM parsing engine parses the webpage structure based on the Document Object Model (DOM) standard and generates a node tree model.
[0144] Region positioning module: Identifies target table regions using preset positioning strategies (such as XPath, CSS selectors, and table feature recognition);
[0145] The second rendering control module interacts with the browser's rendering engine to obtain the target table's coordinates, visual status, and hierarchical relationship.
[0146] The Chrome extension selects one or more of the following location strategies to execute based on user configuration or automatic detection results:
[0147] Location based on unique identifiers:
[0148] If the target table has unique attributes (such as id="target-table" or data-role="data-paste"), then it can be located directly using the document.getElementById() or document.querySelector() function;
[0149] If the table is nested within a specific container (such as...) If the container path is used, the target will be located level by level (e.g., div.report-container>table:nth-of-type(1)).
[0150] Localization based on table features:
[0151] Structural feature matching: by traversing all
[0152] Tags, filter tables that meet the following criteria: contain a specific number of columns (e.g., ... (Quantity: 5 columns)
[0153] The table header contains keywords (such as...) The text contains "product name" and "price");
[0154] The table has a fixed style (such as border="1" or class="data-grid").
[0155] For the extracted structured data field names (such as ["product name", "price", "inventory"]), calculate the Levenshtein distance with the header text of all tables in the webpage, and select the table with the highest similarity as the target.
[0156] Location based on user interaction:
[0157] If automatic location fails, the Chrome extension generates a floating tooltip at the top of the page, guiding the user to manually click on the target table;
[0158] Listen for user click events, obtain the DOM node of the clicked table through the element node event (event.target event) that actually triggered the event, and record its XPath or CSS selector to the plugin's local storage.
[0159] In this embodiment, to ensure user confirmation of location accuracy, the Chrome plugin performs the following visual feedback operation:
[0160] Dynamically add the CSS class name target-table-highlight to the located target table and set its style as follows:
[0161] Coordinate location hint: A floating label is displayed in the upper left corner of the table with the content "Target area located (X:100, Y:200)", where the coordinate values are obtained through element.getBoundingClientRect();
[0162] Multi-region conflict handling: If multiple tables that meet the criteria are detected, they are sorted and numbered according to similarity (e.g., "Target Region 1" "Target Region 2"). Users can switch between them via the plugin toolbar.
[0163] like Figure 8 As shown, the Chrome extension performs the following compatibility checks and error handling on the target table:
[0164] Verify that the number of rows and columns in the target table matches the structured data extracted in the data extraction step (e.g., if the extracted data is 5 rows and 3 columns, then the target table must contain at least 5 rows and 3 columns).
[0165] If a mismatch occurs, a warning message will be generated: "The target table structure is incompatible with the data and some data may be lost," and the options of "Force Paste" (aligned by columns) or "Cancel Operation" will be provided.
[0166] The MutationObserver continuously monitors DOM changes in the target table. If content updates are detected (such as adding rows or deleting columns), the positioning strategy is re-executed and the highlight is updated. Timed polling (such as checking every 5 seconds) is set to ensure accurate positioning in web pages that load data asynchronously.
[0167] If the second webpage and the data extraction page are from different origins, cross-domain access permissions are obtained through the postMessage mechanism or browser extension permissions (chrome.permissions.request).
[0168] If permission acquisition fails, the user will be prompted that "cross-domain access needs to be authorized to locate the target table" and a link will be provided to redirect to the permission settings page.
[0169] In this embodiment, the Chrome plugin performs final verification of the location results and provides feedback to the user in the following way:
[0170] Verification index calculation:
[0171] Accuracy: Calculates the field overlap rate between the located table and the expected target (e.g., number of matched fields / total number of fields × 100%).
[0172] Coverage: The percentage of fillable cells in a table containing the target data (e.g., number of fillable cells / total number of cells × 100%).
[0173] If the accuracy is ≥90% and the coverage is ≥85%, a green prompt will appear in the toolbar: "Target area successfully located, safe to paste."
[0174] If the indicators do not meet the standards, a red warning will be displayed: "Location results may be inaccurate. Please check the target table." The warning will also list the names of the mismatched fields and suggested actions (such as manually adjusting the location strategy).
[0175] In the data matching and filling steps, the Chrome extension performs uniform preprocessing on the extracted structured data field names and target table column names to eliminate format differences and improve matching accuracy:
[0176] Text normalization: Convert all field names to lowercase (e.g., "product name" → "product name"); remove leading and trailing spaces and special characters (e.g., "price (yuan)" → "price"); standardize the separator (e.g., "inventory_quantity" → "inventory quantity").
[0177] Semantic expansion: Replace field names with synonyms (e.g., "unit price" → "price", "inventory quantity" → "inventory"); expand the matching range through a pre-built semantic mapping table (e.g., {"product ID":"product number", "SKU":"item number"}); extract the core word ("Price") from mixed English fields (e.g., "Price(USD)") and translate it into Chinese ("price").
[0178] Word segmentation and weight calculation: Long field names are segmented into Chinese words (e.g., "Total sales (including tax)" → "Total sales" "including tax"); weights are assigned to the segmentation results (core words weight 0.8, modifiers weight 0.2) for subsequent similarity calculation.
[0179] The Chrome extension uses a combination of the following strategies based on the pre-processed field names to achieve precise matching of the target table columns:
[0180] Exact match: If the structured data field name is exactly the same as the target table column name (e.g., "Price" → "Price"), then a mapping relationship is established directly; for columns containing unique identifiers (e.g., "Order Number" "Product Code"), exact match is performed first.
[0181] Fuzzy matching: Similarity calculation: An improved Levenshtein distance algorithm is used, combined with word segmentation weights, to calculate field similarity, expressed as:
[0182]
[0183] in, t i Tokenize structured fields. c i Segment the target column. w i For word segmentation weights, match( t i , c i The result is a binary match (1 indicates a match, 0 indicates no match).
[0184] If the similarity is greater than or equal to the set threshold, such as 0.7 (configurable), then a mapping relationship is established (e.g., "product name" → "product name").
[0185] If multiple target columns match the same structured field (e.g., both "unit price" and "price" match), the column with the highest similarity is selected, and a conflict log is recorded for user verification.
[0186] For columns that cannot be directly matched by field name, analyze the contents of other columns in the same row (e.g., if the "Unit" column is next to the "Price" column, then infer that the column is "Quantity").
[0187] Matching is aided by a pre-defined business rule base (such as "price × quantity = amount").
[0188] In this embodiment, as Figure 9 As shown, based on the matching results, the Chrome extension populates the target table with structured data according to the following rules:
[0189] Single-column fill: For columns with exact or high similarity matches, directly fill the target column with the values of the corresponding fields from the structured data; data type is preserved during fill (e.g., numeric values are filled with numeric values). The data-type="number" attribute.
[0190] Multi-column filling: If the target table needs to split structured fields (e.g., split "address" into "province", "city", and "district"), then the sub-fields are extracted and filled using preset splitting rules (e.g., regular expression / (.*?province)(.*?city)(.*?district) / ); for merged filling scenarios (e.g., merging "name" and "phone" into "contact information"), the fields are concatenated and filled according to a specified format (e.g., "Zhang San-138****8000").
[0191] Dynamically adapt and fill: If the number of target columns is greater than the number of structured fields, fill the remaining columns with default values (such as empty strings, 0 or N / A); if the number of target columns is less than the number of structured fields, generate a warning message "Insufficient target table columns, data in XX field may be lost", and provide "truncate fill" or "skip fill" options.
[0192] In this embodiment, the Chrome plugin performs conflict detection and data validation during the fill process to ensure the accuracy of the fill results, including:
[0193] Type conflict detection: Check if the fill value is compatible with the data type of the target column (e.g., numeric columns should not be filled with text); if incompatible, try type conversion (e.g., convert the text "123" to a number); if the conversion fails, mark it as an error cell.
[0194] Value range validation: For numeric columns, check whether the filled value is within the preset range (e.g., "Price" should be between 0 and 10000); for date columns, validate whether the format is YYYY-MM-DD and not a future date.
[0195] Uniqueness constraint check: For primary key columns (such as "order number"), check whether the fill value is repeated; if repeated, automatically generate a unique suffix (such as "ORD-001" → "ORD-001-1").
[0196] In this embodiment, the Chrome plugin provides feedback on the population results to the user in the following ways:
[0197] Visual markers: Add a light green background to successfully filled cells; add a red border and display an error icon to erroneous cells (type conflict, range out of bounds, etc.).
[0198] Statistical report generation: The toolbar displays a summary of the fill, which reads "XX entries successfully filled, XX entries with errors, XX entries skipped"; it also provides a "Download Error Log" button to generate a CSV file containing error types, cell locations, and suggested repair methods.
[0199] User interaction correction: Allow users to correct erroneous cells via the right-click menu, selecting "Rematch Fields", "Manually Enter Values", or "Ignore Errors"; For batch errors (such as mismatched data types in an entire column), a "Global Correction" function is provided (e.g., converting the entire column from text to numbers).
[0200] In the data validation and adjustment steps, each piece of data filled into the target table is validated one by one according to preset validation rules. These preset validation rules include, but are not limited to, data type validation rules, which verify whether the type of the filled data is consistent with the data type required by the corresponding field in the target table. For example, if a field in the target table requires an integer type, the data filled in is verified to be an integer. Data range validation rules are used to verify whether the filled data is within a preset reasonable value range. For example, if a field representing age has a preset range of 0-120 years, the age data filled in is verified to be within this range. Data integrity validation rules are used to verify whether the filled data is complete and whether there is any missing key information. For example, for records containing information such as name and address, all required fields are verified to be filled. Data consistency validation rules are used to verify whether the filled data is consistent across different related fields or different related tables. For example, in multiple tables involving customer information, the customer number should remain the same.
[0201] During the verification process, a combination of automated scripts and manual sampling is used. Automated scripts perform rapid batch verification of a large amount of data according to preset verification rules, thereby improving verification efficiency. At the same time, manual sampling re-examines some data in the verification results of the automated scripts to ensure the accuracy of the verification. The proportion of manual sampling is dynamically adjusted according to the importance and risk level of the data. For critical data or high-risk data, the proportion of manual sampling is increased.
[0202] Based on the verification results obtained in the data verification phase, data that fails verification is marked. Marking methods include, but are not limited to, adding special identifiers to the corresponding data positions in the target table, such as highlighting in red, or adding comments next to the data explaining the reasons for the failure of verification.
[0203] For data that fails validation, take appropriate adjustment measures based on the different reasons for the failure. If the data type is mismatched, convert the data type to conform to the data type requirements of the target table field. If the data is out of range, correct the data to a reasonable range; for example, for data exceeding the age range, make reasonable estimates and corrections based on the actual situation. If the data is missing, supplement the missing data by querying the original data source and communicating with relevant personnel for confirmation. If the data is inconsistent, analyze the reasons for the inconsistency, unify the data content, and ensure the consistency of data across different related fields or tables.
[0204] After completing the data adjustment, verify the adjusted data again to ensure that the adjusted data meets all preset verification rules; if there are still cases that fail the verification, repeat the above adjustment steps until all data passes the verification.
[0205] Furthermore, the plugin supports the recognition and extraction of various table formats, including HTML tables and Excel tables. Whether the data source is an HTML table from a webpage or an Excel table exported through other means, the plugin can accurately identify and process it, improving its versatility and applicability.
[0206] Furthermore, the plugin provides a data mapping function, allowing users to customize the column name mapping between the data source table and the target table. In some cases, the column names in the data source table and the target table may differ, but the data meaning is the same. Through the data mapping function, users can manually specify the mapping between column names to ensure that the data is accurately populated into the target table.
[0207] Furthermore, the plugin supports batch copy and paste operations, allowing users to select multiple tables or multiple target tables for copying and pasting at once, greatly improving work efficiency. Especially when processing large amounts of data, batch operations can significantly reduce operation time and steps.
[0208] Furthermore, the plugin offers a data caching function, allowing users to save the extracted data locally for later use. Users can cache the data when it is not needed to paste it immediately, and then read it from the local machine and populate it into the target table when required, avoiding the repeated data extraction operation.
[0209] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0210] The above embodiments are merely preferred embodiments of the present invention and should not be construed as limiting the scope of protection of the present invention. Any non-substantial changes and substitutions made by those skilled in the art based on the present invention shall fall within the scope of protection claimed by the present invention.
Claims
1. A method for quickly copying forms based on a browser plugin, characterized in that, Includes the following steps: Plugin installation and activation steps: Complete the installation and activation of the Chrome plugin in the client browser environment; Data source selection steps: Open the first webpage and select the table data area to be copied through interactive operations. The Chrome plugin uses DOM parsing technology to parse the webpage content, identify the selectable table area and highlight it. Data extraction steps: Trigger the extraction function of the Chrome plugin, extract the data from the selected table area through the Chrome plugin, and convert the extracted data into a structured data format; Target page location steps: Open the second webpage and locate the table area where you need to paste data. The Chrome extension uses DOM parsing technology to parse the target webpage content and identify the target table. When the user opens the second webpage through the client browser, the extension's background script automatically performs the following operations: Page state monitoring: Monitor changes in the DOM structure of the target webpage through the MutationObserver API to ensure that the positioning operation is performed only after the HTML document has been fully loaded and the DOM tree has been built. Plugin script injection: This involves calling the browser's `chrome.scripting.executeScript` interface to inject a location initialization script into the target webpage. This script includes the following functional modules: Second DOM parsing engine: Parses the webpage structure based on the Document Object Model standard and generates a node tree model; Area positioning module: Identifies the target table area using a preset positioning strategy; The second rendering control module interacts with the browser rendering engine to obtain the coordinate position, visual status, and hierarchical relationship of the target table. The Chrome extension selects one or more location strategies—based on unique identifiers, based on user configuration, or based on table features—to execute, depending on user configuration or automatic detection results. For the extracted structured data field names, calculate the Levenshtein distance with the header text of all tables in the webpage, and select the table with the highest similarity as the target table; Data matching and filling steps: The Chrome extension automatically matches the extracted structured data with the column names of the target table, and automatically fills the data into the corresponding cells of the target table according to the matching results; Data validation and adjustment steps: Validate the data populated into the target table and adjust it based on the validation results; the Chrome extension performs the following compatibility checks and error handling on the target table: Verify that the number of rows and columns in the target table matches the structured data extracted in the data extraction step; if they do not match, generate a warning and provide options to force paste or cancel the operation; continuously monitor DOM changes in the target table using a change observer, and if content updates are detected, re-execute the positioning strategy and update the highlight display; set up timed polling to ensure accurate positioning in asynchronously loaded web pages; if the second web page is from a different origin than the data extraction page, obtain cross-domain access permissions through the postMessage mechanism or browser extension permissions; if permission acquisition fails, prompt the user to authorize cross-domain access to locate the target table and provide a link to the permission settings page.
2. The method according to claim 1, characterized in that: During the plugin installation and activation process, when the client browser triggers a plugin installation request, it resolves the server domain name through a preset protocol packet name and retrieves the plugin configuration data from the server's Redis cache in JSON array format. The configuration data includes at least the plugin identifier, target operating system type, browser kernel type, installation condition rules, and activation dependencies. If the current system time is detected to be within the preset plugin configuration update cycle, a data acquisition request will be forcibly triggered, and the data integrity will be verified. Obtain the client's first operating system type, first browser kernel version, and list of installed plugins. Compare the first operating system type with the second operating system type in the plugin configuration data. Cross-validate the first browser kernel version with the second kernel version in the configuration data. If the comparison results are consistent, the system will further verify whether there is a similar plugin that conflicts with the target plugin in the list of installed plugins. If so, a conflict warning will be generated and the activation process will be terminated.
3. The method according to claim 2, characterized in that, The corresponding installation condition rule engine is invoked based on the plugin type, including the following steps: For ActiveX plugins that require binding to the system registry, verify whether the client has administrator privileges and check if the target exists in the registry path; For PPAPI / NPAPI plugins, verify that the browser plugin directory contains the plugin file of the specified version, and verify that the file hash value matches the checksum in the configuration data; If the verification passes, a temporary activation token is generated and stored in the client's local cache; An activation verification request is sent to the server based on the temporary activation token. The server returns an activation script containing dynamic parameters, which is then parsed by the browser's extension manager.
4. The method according to claim 1, characterized in that: In the data source selection step, when the first webpage is opened through the client browser, the plugin's background script is automatically injected into the webpage's header tag to listen for whether the page has completed loading the HTML document and constructing the DOM tree. The plugin extension manager calls the Chrome extension development interface provided by the browser to inject the first initialization script into the current tab. The first initialization script includes the following functional modules: First DOM parsing engine: Parses webpage structure based on the Document Object Model standard and generates a node tree model; Region identification module: Traverses all table container tags using XML path language or CSS selectors; First rendering control module: Interacts with the browser rendering engine to obtain the coordinate position and visual status of each table area; The Chrome extension generates a semi-transparent floating toolbar at the top of the page, containing a button to select the data source. Clicking this button triggers the following action: The Chrome extension iterates through all identified table areas and retrieves their border styles using a global function that is used to get the current calculated style of an element. Dynamically add CSS class names to each table area; If the table area has a nested structure, only the outermost container is marked.
5. The method according to claim 4, characterized in that, The plugin listens for mouse events, and when the user hovers the mouse over the marked area: Trigger the mouse hover event and change the CSS class name of the current area to data-hover; When a mouse click event is triggered, record the following information about the selected area: DOM path: Generates a complete XPath from the parent node to the target node by retrieving all node attribute events; Row and column range: Parse and label count to determine the starting row / column index and total number of rows / columns of the table; Data Snapshot: Uses attribute events to get or set the HTML content inside an element to get the HTML string of the current area and store it in the plugin's local cache.
6. The method according to claim 1, characterized in that: During the data extraction step, when the "Extract Data" button in the plugin toolbar is clicked or the extraction command is triggered via a shortcut key, the plugin's background script performs the following operations: Call the Chrome extension development interface provided by the browser to send an extraction request containing the selected region identifier to the extension backend; The backend server obtains the ID of the currently active tab using the chrome.tabs.query function and injects the data extraction script into the target webpage context; The Chrome extension performs the following extraction operations based on the recorded selected area information: Header parsing: Iterate through the labels within the selected area, extract the header text, and construct an array of field names named headers; Cell positioning: Locate all nodes using functions that query DOM nodes via XPath, mapping them to a two-dimensional array by row and column indices; Perform data cleaning processing on the content of each cell, including text normalization, numerical conversion, date standardization, and handling of blank values; The Chrome extension converts cleaned data into structured data.
7. The method according to claim 1, characterized in that: In the data matching and filling step, the Chrome plugin performs unified preprocessing on the extracted structured data field names and target table column names. This preprocessing includes at least text normalization, semantic expansion, word segmentation, and weight calculation. The Chrome extension uses a combination of the following strategies to match target table columns based on the pre-processed field names: Exact match: If the structured data field name is exactly the same as the target table column name, a mapping relationship is established directly; for columns containing unique identifiers, exact match is performed first. Fuzzy matching: An improved Levenshtein distance algorithm is used, combined with word segmentation weights to calculate field similarity, expressed as: in, t i Tokenize structured fields. c i Segment the target column. w i For word segmentation weights, match( t i , c i () represents the result of a binary matching. If the similarity is greater than or equal to the set threshold, then a mapping relationship is established; If multiple target columns match the same structured field, the column with the highest similarity is selected, and a conflict log is recorded for user verification. For columns that cannot be directly matched by field name, analyze the contents of other columns in the same row and use a pre-built business rule library to assist in matching.
8. The method according to claim 7, characterized in that, Based on the matching results, the Chrome extension populates the target table with structured data according to the following rules: Single-column fill: For columns with exact matches or high similarity matches, directly fill the target column with the values of the corresponding fields from the structured data; data type is preserved during the fill process; Multi-column fill: If the target table needs to be split into structured fields, the sub-fields are extracted and filled according to the preset splitting rules; for merged fill scenarios, the fields are concatenated and filled according to the specified format. Dynamic adaptive filling: If the number of target columns exceeds the number of structured fields, fill the remaining columns with default values; If the number of target columns is less than the number of structured fields, a warning message is generated, and options to truncate or skip the fill are provided.
Citation Information
Patent Citations
Browser plug-in-based data query method and device
CN107437158A
Method and apparatus for automatically entering data
CN108170688A