Image extraction method in excel file and electronic device
By parsing the complex document structure of Excel files, constructing a data list, and using a recursive algorithm, the problem of accurate image location extraction in Excel files was solved, achieving lossless and accurate image extraction and recording, and ensuring the accuracy and consistency of image position.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SHENZHENSHI YUZHAN PRECISION TECH CO LTD
- Filing Date
- 2022-12-21
- Publication Date
- 2026-05-26
AI Technical Summary
Existing technologies cannot effectively extract images from Excel files, and when calling third-party development packages through high-level programming languages, images are prone to distortion, making it impossible to accurately locate image positions, resulting in problems such as missing or lost pixels.
By parsing the complex document structure of an Excel file, the positional information of the original images is extracted and labeled. A data list is constructed to record the display position and repetition of images in the Excel file. A recursive algorithm is used to determine the exact position of the images in tabs and cells, and the images are renamed to distinguish different images.
It enables lossless image extraction from Excel files, accurately determines the page tab and cell position of the image, avoids image distortion and position recognition errors, and provides a more accurate and comprehensive image record, which facilitates the analysis of the displayed content of Excel files.
Smart Images

Figure CN116304189B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a method and electronic device for extracting images from an Excel file. Background Technology
[0002] Excel is a spreadsheet software. It features an intuitive interface and excellent calculation capabilities, transforming complex data into the information users need. Excel processes data and generates Excel files. Excel files are spreadsheet files created using Excel.
[0003] Calling macro functions in an Excel file allows for formulaic manipulation of data and changing file styles. Macro functions are part of Excel's native coding language and were used in older versions of Excel. However, there is a technological gap in extracting images from Excel files; it is not possible to extract images from Excel files in this way.
[0004] Using high-level programming languages and third-party development packages (SDKs) can perform operations such as extracting data from Excel files, analyzing Excel data, extracting images from Excel files, changing table styles, and modifying table structures. While third-party SSDs exist for high-level programming languages, they support reading, querying, and modifying Excel files and allow for programmatic settings of styles and images. However, images extracted in this way are often distorted, with missing pixels. Furthermore, extracting images from Excel files using this method also suffers from problems such as inability to locate images and missing images.
[0005] Therefore, a method for extracting images from Excel files is needed. Summary of the Invention
[0006] To address the problem of extracting images from Excel files, this application provides a method and electronic device for extracting images from Excel files, and also provides a computer-readable storage medium.
[0007] The embodiments of this application adopt the following technical solutions:
[0008] In a first aspect, this application provides a method for extracting images from an Excel file, the method being applied to an electronic device, the method comprising:
[0009] Get the Excel file and extract all the original images from it;
[0010] Parse all the original images in the Excel file and determine the position information of each original image. The position information is used to describe the display position of the original image in the Excel file.
[0011] Based on the location information of each original image, abnormal original images are identified. The abnormal original images include original images that appear repeatedly in different cells and multiple original images that exist in the same cell.
[0012] In one implementation of the first aspect, obtaining the Excel file and extracting all original images from the Excel file includes:
[0013] Obtain and parse the Excel file to obtain a composite document, the composite document including a first folder containing the original images inserted in the Excel file;
[0014] Extract the original images from the first folder and store them according to the set format.
[0015] In one implementation of the first aspect, the composite document further includes a second folder containing basic information for each tab and a third folder containing image insertion information for the original image inserted in the corresponding tab; the location information includes the tab position describing the tab containing the original image in the excel file;
[0016] The process involves parsing all original images in the Excel file and determining the location information of each original image, including:
[0017] Based on the basic information of the tabs in the second folder, and according to the image insertion information in the third folder, the tab position of the original image is located.
[0018] In one implementation of the first aspect, the second folder includes multiple tab files storing the basic information, and the multiple tab files are sorted according to a set rule; the third folder includes multiple image files storing the image insertion information, and each image file corresponds to a tab in the Excel file;
[0019] The step of locating the tab position of the original image based on the image insertion information in the third folder includes:
[0020] Search each of the tab files to see if there is an image tag;
[0021] If the image tag exists, then the image file in the third folder corresponding to the tab file containing the image tag is determined according to the sorting of the tab files in the second folder;
[0022] By integrating the tab files corresponding to all the image files, the correspondence between the original images corresponding to the image files and the tabs in the Excel file is obtained.
[0023] In one implementation of the first aspect, the image file includes coordinate position information of the original image inserted into a tab of the Excel file; the position information includes information describing the coordinate position of the original image in the Excel file on the tab;
[0024] The process involves parsing all original images in the Excel file and determining the location information of each original image, including:
[0025] Each image file is parsed to determine the coordinate position information of each original image in the image file.
[0026] In one implementation of the first aspect, the step of identifying multiple original images existing in the same cell includes:
[0027] Construct a first data list, the list items of the first data list include a position information item and a first repetition number item, the position information item is used to record the position information of the cell on the tab where the original image is inserted, and the first repetition number item is used to record the number of original images displayed in the cell;
[0028] Obtain the position information of the original image inserted in the tab of the Excel file;
[0029] Compare the location information already saved in the first data list to see if the acquired location information already exists;
[0030] If the obtained location information is not found in the location information already saved in the first data list, the obtained location information is recorded in the first data list, and the value of the first repetition count item corresponding to the obtained location information is recorded as 1;
[0031] If the obtained location information exists in the location information already saved in the first data list, increment the value of the first repetition count item corresponding to the obtained location information in the first data list by 1.
[0032] In one implementation of the first aspect, the step of marking the recurrence of different cells in the original image includes:
[0033] Construct a second data list, the list items of the second data list include an original image item and a second repetition count item, the original image item is used to record the identification information of the original image, and the second repetition count item is used to record the number of times the original image is displayed repeatedly;
[0034] Obtain the identification information of the original images inserted in the tabs of the Excel file;
[0035] Compare whether the acquired identification information already exists in the saved identification information in the second data list;
[0036] If the obtained identification information is not found in the identification information already saved in the second data list, the obtained identification information is recorded in the second data list, and the value of the second repetition count item corresponding to the obtained identification information is recorded as 0 or empty;
[0037] If the obtained identification information exists in the identification information already saved in the second data list, the value of the second repetition count item corresponding to the obtained identification information in the second data list is incremented by 1.
[0038] In one implementation of the first aspect, the method further includes:
[0039] The original image is renamed based on its location information, and the renamed original image is saved.
[0040] In one implementation of the first aspect, the name of the renamed original image includes a combination of any one or more of the following:
[0041] Image identifiers, which are used to distinguish different original images, and different original images have different image identifiers;
[0042] Tab identifiers, which are used to distinguish different tabs in the Excel file;
[0043] Location description, which describes the display position of the original image on the tab.
[0044] In one implementation of the first aspect, renaming the original image according to its location information and saving the renamed original image includes:
[0045] If the original image is displayed in multiple locations within the Excel file, the original image is saved as multiple image copies, wherein:
[0046] Each copy of the image corresponds to a display location of the original image in the Excel file.
[0047] In one implementation of the first aspect, the name of the renamed original image further includes: the number of repetitions, which describes how many times the original image is repeated in the excel file, corresponding to the display position of the current image copy.
[0048] In one implementation of the first aspect, renaming the original image according to its location information and saving the renamed original image includes:
[0049] Construct a third data list, wherein the list items of the third data list include an original image item, a third repetition count item, a tab item, and a position information item. The original image item is used to record the identification information of the original image. The third repetition count item is used to record the number of times the original image is displayed. The tab item is used to record the identification information of the tab where the original image is located. The position information item is used to record the position information of the cell on the tab where the original image is inserted.
[0050] Obtain the identification information of the original image inserted in the tab of the Excel file, the identification information of the tab where the original image was inserted, and the position information of the cell where the original image was inserted;
[0051] Compare the identification information already saved in the original image item of the third data list to see if the identification information of the obtained original image already exists;
[0052] If the identification information of the obtained original image is not found in the identification information already saved in the original image item of the third data list, the identification information of the obtained original image, the identification information of the tab to which the original image is inserted, and the position information of the cell to which the original image is inserted are recorded in the original image item, tab item, and position information item of the third data list, and the value of the corresponding third repetition count item is recorded as 0.
[0053] If the identification information of the obtained original image exists in the original image item of the third data list, the identification information of the obtained original image, the identification information of the tab to which the original image is inserted, and the position information of the cell to which the original image is inserted are recorded in the original image item, tab item, and position information item of the third data list. In addition, the value of the corresponding third repetition count item is recorded as the value of the third repetition count item corresponding to the number of the previous original image + 1.
[0054] The original image is renamed and saved based on the records in the third data list that have been completed.
[0055] In a second aspect, this application provides an electronic device, which includes a memory for storing computer program instructions and a processor for executing the computer program instructions, wherein when the computer program instructions are executed by the processor, the electronic device is triggered to perform the steps of the method described in the first aspect.
[0056] Thirdly, this application provides a computer-readable storage medium storing a computer program that, when run on a computer, causes the computer to perform the method described in the first aspect.
[0057] According to the method of this application embodiment, the original image is extracted from the Excel file, the tab where the original image is located and the display position of the original image in the tab are determined, and cells in the Excel file containing multiple original images and original images that are repeatedly displayed in multiple different cells are marked. This can provide a more accurate and comprehensive record of the original images in the Excel file, which is convenient for analyzing the display content of the Excel file by corresponding to the original images.
[0058] Furthermore, according to the method of this application embodiment, the original image is extracted from the Excel file by directly extracting and saving the original image from the first folder, which avoids the image distortion caused by extracting the image from the display page of the Excel file and increases the accuracy of image extraction from the Excel file.
[0059] Furthermore, according to the method of this application embodiment, the position information of the image on the display page of the Excel file is obtained based on the recorded content in the tab file and the image file, instead of directly identifying the position information of the image from the display page of the Excel file. This effectively avoids the problem of image position recognition error and ensures the accuracy of the obtained image position.
[0060] Furthermore, according to the method of this application embodiment, by recording the position information of the original images inserted in the tabs one by one in the first data list, the cell containing multiple original images can be determined. This can avoid the situation where multiple original images displayed in a single cell are identified as one image when directly identifying images from the display page of the Excel file, thereby accurately identifying the cell containing multiple original images.
[0061] Furthermore, according to the method of this application embodiment, by recording the identification information and position information of the original images inserted in the tabs one by one in the second data list, the original images repeatedly displayed in multiple different cells can be determined. This can avoid the situation where multiple cells that display the same image are identified as cells that display different images when directly identifying images from the display page of the Excel file, thereby accurately identifying the original images that repeatedly appear in multiple different cells.
[0062] Furthermore, according to the method of this application embodiment, the original image is renamed based on the position information of the original image. The name of the original image reflects the tab of the original image in the Excel file and its display position in the tab. This can intuitively distinguish different original images, provide a more accurate and comprehensive record of the original images in the Excel file, and facilitate the analysis of the display content of the Excel file by corresponding to the original images.
[0063] Furthermore, according to the method of this application embodiment, for an original image that is repeatedly displayed in multiple different cells, an image copy corresponding to each cell displaying the image is created, and the original image that is repeatedly displayed in multiple different cells is marked by the name of the original image, so that the number of original images finally saved is consistent with the number of images displayed in the Excel file, thereby providing a more accurate and comprehensive record of the original images of the Excel file, which facilitates the analysis of the display content of the Excel file by corresponding to the original images.
[0064] According to the method of this application embodiment, original images can be extracted from an Excel file without loss, and the tab containing the original image and its display position within the tab can be accurately determined. Furthermore, according to the method of this application embodiment, cells in an Excel file containing multiple original images and original images repeatedly displayed in multiple different cells can be accurately marked. Furthermore, according to the method of this application embodiment, a record of original images consistent with the number of images displayed in the Excel file can be provided. Moreover, the naming of the original images indicates the tab containing the original image, its display position within the tab, and whether it is a repeating image in multiple different cells, thereby providing a more accurate and comprehensive record of the original images in the Excel file, facilitating the analysis of the displayed content of the Excel file through the correspondence between the original images and the data. Attached Figure Description
[0065] Figure 1 The diagram shown is a flowchart of an image extraction method from an Excel file according to an embodiment of this application;
[0066] Figure 2 The diagram shown is a partial flowchart of an image extraction method from an Excel file according to an embodiment of this application.
[0067] Figure 3 The diagram shown is a partial flowchart of an image extraction method from an Excel file according to an embodiment of this application.
[0068] Figure 4 The diagram shown is a schematic of the recursive algorithm logic.
[0069] Figure 5The diagram shown is a partial flowchart of an image extraction method from an Excel file according to an embodiment of this application.
[0070] Figure 6 The diagram shown is a partial flowchart of an image extraction method from an Excel file according to an embodiment of this application.
[0071] Figure 7 The diagram shown is a partial flowchart of an image extraction method from an Excel file according to an embodiment of this application. Detailed Implementation
[0072] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below in conjunction with specific embodiments and corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0073] The terminology used in the implementation section of this application is for the purpose of explaining specific embodiments of this application only, and is not intended to limit this application.
[0074] To address the problem of how to extract images from Excel files, this application provides a method for image extraction from Excel files.
[0075] Figure 1 The diagram shows a flowchart of an image extraction method from an Excel file according to an embodiment of this application. The electronic device executes... Figure 1 The following process is shown to achieve image extraction.
[0076] S101, retrieve the Excel file.
[0077] S102, extract all inserted original images from the Excel file.
[0078] Figure 2 The diagram shown is a partial flowchart of an image extraction method from an Excel file according to an embodiment of this application. In one implementation of S102, the electronic device performs... Figure 2 The following process is shown to extract the original image from the Excel file.
[0079] S201, Read Excel file.
[0080] In some embodiments, electronic devices use xlrd to read Excel files. xlrd is a reading module in a third-party development library for high-level programming languages (e.g., Python). The function of xlrd is to read files. Specifically, xlrd reads information such as the number of rows and columns, row values, column values, or cell values, data types, and images from the data in the Excel file.
[0081] After the electronic device reads the information from the Excel file, it uses the `sheets` method to retrieve all the worksheets in the Excel file. The `sheets` method is used to retrieve worksheets from an Excel file.
[0082] S202, Copy the Excel file and save the copied Excel file.
[0083] In some embodiments, electronic devices use shutil to copy Excel files. Shuutil is an operations module in a third-party development library for high-level programming languages (e.g., Python). Shuutil's functions include copying, deleting, moving, compressing, and decompressing Excel files. By copying an Excel file and performing subsequent operations on the copied file, the original Excel file can be preserved, preventing the inability to trace back to the original file in case of errors in subsequent operations.
[0084] S203, change the file extension of the copied Excel file to .zip to generate a compressed Excel file.
[0085] Specifically, the original file extension of an Excel file is .xlsx or .xls. To create the necessary decompression environment, the file extension is changed to .zip, resulting in a compressed Excel file.
[0086] S204: Use the decompression function to decompress the compressed Excel file and obtain a composite document.
[0087] In some embodiments, the zipfile decompression function is used to decompress the compressed Excel file to obtain a composite document.
[0088] Specifically, in one embodiment, the composite document may be a loose-leaf folder XL containing Excel content, i.e., an XL folder, and the composite document includes at least a first folder, a second folder, and a third folder.
[0089] The first folder can be a media folder, used to store the original images. In one embodiment, the original images stored in the first folder are named according to their numbers. For example, in one embodiment, the first folder contains files such as image1.png, image2.png, and image3.png.
[0090] The second folder can be a "sheet" folder, used to store basic information for each tab in the Excel file. Specifically, the second folder includes multiple tab files (sheet files) that store basic information for each tab. These multiple tab files in the second folder are numbered and sorted according to a set rule (e.g., the tab order in an Excel spreadsheet). For example, in one embodiment, the second folder contains files sheet1.xml, sheet2.xml, sheet3.xml, etc. The file sheet1.xml describes the basic information for the first tab in the Excel file; the file sheet2.xml describes the basic information for the second tab; and the file sheet3.xml describes the basic information for the third tab.
[0091] The third folder, which can be a "drawing" folder, is used to store image insertion information for the original images inserted into the corresponding tabs. When displaying the tabs, the original images are inserted into the tabs based on this information. Specifically, the third folder contains multiple image files (drawing files) that store the image insertion information for the corresponding tabs. Each image file contains the insertion position of the original image within the tab when it was inserted, i.e., its coordinate position information, such as the row number and column number.
[0092] For example, the third folder contains image files such as drawing1.xml and drawing2.xml. The file drawing1.xml is used to describe the image insertion information for inserting the original image into the first tab of the Excel file (describing the insertion position of the original image in the first tab); the file drawing2.xml is used to describe the image insertion information for inserting the original image into the second tab of the Excel file (describing the insertion position of the original image in the second tab).
[0093] S205, Extract the original image from the first folder in the composite document.
[0094] In one implementation of S205, it is determined whether a first folder exists in the composite document. The first folder is used to store the original image information when the Excel file is uploaded.
[0095] If the first folder does not exist in the composite document, it means that the original image does not exist in the composite document, and the process ends.
[0096] If a first folder exists in the composite document, extract the original images from the first folder.
[0097] S207 converts the original image into a preset encoding format.
[0098] Image encoding represents an image or image information using a smaller number of bits. Using image encoding can reduce the amount of data needed to store an image. In one embodiment, the original image is converted to base64 encoded form for easier storage.
[0099] S208 stores the encoded data of the original image based on a set format.
[0100] Specifically, in one implementation of S208, a dictionary is defined to record the original image; the dictionary is a database for storing information.
[0101] Specifically, the dictionary is in the form of img_index, img_path, and img_base64. Here: img_index stores the original image's index within the first folder; img_path stores the original image's location within the first folder; and img_base64 stores the bases64 encoded information of the original image.
[0102] The dictionary is used to record the original image's index, location, and image type. The encoded dictionary format is: {img_index:num,img_path:PATH,img_base64:xxx}. Here, num is the original image's index, PATH is the original image's path, and xxx is the bases64 encoded image.
[0103] According to the method of this application embodiment, the original image is extracted from the Excel file by directly extracting and saving the original image from the first folder, which avoids the image distortion caused by extracting the image from the display page of the Excel file and increases the accuracy of image extraction from the Excel file.
[0104] Furthermore, the number of original images stored in the first folder is inconsistent with the number of images displayed in the Excel file. This is because the Excel file contains different worksheets, and the same image may exist in different worksheets (the same image may also be displayed repeatedly in the same worksheet). For the same image, only one original image is saved in the first folder.
[0105] In response to the above situation, S103 will be executed after S102.
[0106] S103, parse all the original images in the Excel file and determine the position information of each original image. The position information is used to describe the display position of the original image in the Excel file.
[0107] Specifically, in one implementation of S103, the position information of the original image includes the tab position describing the page containing the original image in the Excel file, and the coordinate position information describing the original image on the tab in the Excel file.
[0108] After S208, the electronic device, based on the basic information of the tabs in the second folder and the image insertion information in the third folder, locates the tab position of the original image and determines the tab corresponding to each original image.
[0109] Figure 3 The diagram shown is a partial flowchart of an image extraction method from an Excel file according to an embodiment of this application.
[0110] Specifically, in one implementation, the electronic device performs... Figure 3 The following steps are shown to locate the tab position of the original image.
[0111] S301, Search each tab file in the second folder for the existence of an image tag.
[0112] Specifically, when an image exists in a tab of an Excel file, the corresponding tab file contains an image tag. <drawing / > (Volume label). In S301, search for the existence of each tab file.
[0113] <drawing / > Label, confirmed to exist <drawing / > The label's tab file.
[0114] If an image tag is not found in a tab file, skip that tab file and search the next tab file for an image tag, until all tab files have been searched.
[0115] Figure 4 The diagram shows the logic of a recursive algorithm. Recursive algorithms solve problems by repeatedly breaking them down into subproblems of the same type. For example... Figure 4 As shown, the recursive algorithm contains a recursion condition and an operation function. The recursion condition of the recursive algorithm is that its child nodes have similar attributes. The recursive algorithm traverses its own form information by continuously calling its child nodes. The operation function is used to output the traversed form information.
[0116] In the second folder, each tab file has a tree structure with a root node and child nodes. Furthermore, the child nodes of each tab file have similar attributes, satisfying the conditions for using a recursive algorithm.
[0117] Therefore, in one implementation of S301, the electronic device traverses each tab file using a recursive algorithm, searching for the existence of image tags in each tab file. Specifically, xmldom is a method for acquiring, accessing, and processing XML files. In one implementation of S301, the electronic device uses xmldom to traverse the tab files.
[0118] S302, if an image tag exists, determine the image file in the third folder corresponding to the tab file with the image tag based on the sorting of the tab files in the second folder.
[0119] For example, the second folder contains tab files sheet1.xml, sheet2.xml, and sheet3.xml.
[0120] Assume sheet1.xml and sheet3.xml contain image tags ( <drawing / > (Volume label). According to the order of the tab files, the tab files sheet1.xml and sheet3.xml correspond to the first and third tabs of the Excel file, respectively.
[0121] The third folder contains image files drawing1.xml and drawing3.xml, corresponding to the first and third tabs of the Excel file, respectively.
[0122] The tab file sheet1.xml corresponds to the image file drawing1.xml, and the tab file sheet3.xml corresponds to the image file drawing3.xml. The correspondence is stored as (sheet1, drawing1) and (sheet3, drawing3).
[0123] S303, integrate the tab files corresponding to all image files to obtain the correspondence between the original images corresponding to the image files and the tabs in the Excel file, and determine the tab corresponding to each original image.
[0124] For example, suppose the image file drawing1.xml corresponds to the original images image1.png and image2.png (the image file drawing1.xml is used to describe the image insertion information of the original images image1.png and image2.png inserted into the tab sheet1). Since the tab file sheet1.xml corresponds to the image file drawing1.xml, then the original images image1.png and image2.png correspond to the first tab in the Excel file.
[0125] Assume the image file drawing3.xml corresponds to the original image image3.png (the image file drawing3.xml describes the image insertion information of the original image image3.png inserted into the sheet3 tab). Since the sheet3.xml tab corresponds to the image file drawing3.xml, the original image image3.png corresponds to the third tab in the Excel file.
[0126] Furthermore, in one implementation, the electronic device performs... Figure 3 The following steps are shown to obtain the coordinate position information of the original image on the tab.
[0127] S304, parse each image file in the third folder and determine the coordinate position information of each original image in the image file.
[0128] Specifically, in one implementation of S304, the electronic device uses a recursive algorithm to traverse each image file and search for the coordinate position information of each original image in each image file. See S301.
[0129] Based on the output of S303 and S304, the tab where each original image is located and the coordinate position of the original image on the tab can be obtained, thereby accurately describing the position information of all original images in the Excel file.
[0130] According to the method of this application embodiment, the position information of the image on the display tab of the Excel file is obtained based on the recorded content in the tab file and the image file, instead of directly identifying the position information of the image from the display page of the Excel file. This effectively avoids the problem of image position recognition error and ensures the accuracy of the obtained image position.
[0131] Furthermore, in an Excel file, there may be multiple cells (multiple cells on the same tab, or multiple cells on different tabs) displaying the same image; and there may be a single cell displaying multiple images.
[0132] To avoid confusion, in one embodiment of this application, S104 is performed after S103.
[0133] S104. Based on the position information of each original image, identify abnormal original images. Abnormal original images include the same original image that appears repeatedly in different cells and multiple original images existing in the same cell.
[0134] Figure 5 The diagram shown is a partial flowchart of an image extraction method from an Excel file according to an embodiment of this application.
[0135] In one implementation of S104, the electronic device executes... Figure 5 The following steps are shown to identify multiple original images existing in the same cell.
[0136] S500, construct the first data list, which corresponds to a tab in the Excel file containing the original image.
[0137] In one embodiment, the list items of the first data list include a position information item and a first repetition count item. The position information item is used to record the position information of the cell on the tab where the original image is inserted, and the first repetition count item is used to record the number of original images displayed in the cell.
[0138] Specifically, in one embodiment, the location information items used include row coordinates and column coordinates. The first repetition count item is repeat_num, where num is a variable value.
[0139] Furthermore, in one embodiment, a single column (row, column, repeat_num) is used to record the position information item and the first repetition count item.
[0140] S510, obtain the position information of the original image inserted in the tab corresponding to the first data list.
[0141] Specifically, in one embodiment, the image file contains labels recording row coordinates (row) and column coordinates (col). Based on the correspondence between the original image corresponding to the image file and the tabs in the Excel file, the corresponding image file is parsed, and the row coordinates (row) and column coordinates (col) are obtained from the image file corresponding to the tab of the first data list.
[0142] Specifically, in one embodiment, the image file includes location tags. <xdr:twocellanchor> , <xdr:twocellanchor>This is used to represent the method of determining the position of the original image. The condition for the recursive algorithm is that it exists. <xdr:twocellanchor>The label, once the condition is met, executes the operation function _f(subElementObj) (the operation function is used to obtain the position information within the position label), the parameter is a list of nodes (NodeList) of all elements under the specified node name.
[0143] Electronic devices use a recursive algorithm to parse image files (e.g., drawing1.xml corresponding to the first tab) and obtain a node list (NodeList). The node list (NodeList) contains the row coordinates (row) and column coordinates (col) of the original image inserted in the tab.
[0144] S520, compare the location information already saved in the first data list to see if the location information corresponding to the acquired original image already exists.
[0145] If the location information corresponding to the acquired original image is not found in the location information already saved in the first data list, execute S521.
[0146] S521, the location information corresponding to the acquired original image is recorded in the location information item of the first data list, and the value of the corresponding first repetition number item is recorded as 1.
[0147] Specifically, in one implementation of S521, the location information item records (row, column, repeat_1).
[0148] If the location information corresponding to the acquired original image exists in the saved location information in the data list, execute S522.
[0149] S522, increment the value of the first repetition count item corresponding to the recorded position information item in the first data list by 1.
[0150] Repeat steps S510 to S522 until the position information of all original images inserted in the tab is recorded in the first data list.
[0151] In the final first data list, the location information corresponding to the first repetition count item being 1 points to a cell in the tab that contains only one original image; the location information corresponding to the first repetition count item not being 1 points to a cell in the tab that contains multiple original images, and the value of the repetition count item is the number of original images contained in the cell.
[0152] The above method can be used to identify multiple original images in the same cell for all tabs in an Excel spreadsheet that contain image labels.
[0153] Furthermore, in one embodiment, an original image item is added to the first data list. The original image item is used to record the identification information of the original image (e.g., the file name of the original image or the number of the original image). When recording the location information item and refreshing the repetition count item, the identification information of the original image corresponding to the location information is recorded into the original image item, so that the original image contained in each cell containing the original image can be recorded.
[0154] According to the method in the embodiments of this application, marking multiple original images existing in the same cell can accurately describe the display status of the original images in the Excel file.
[0155] Furthermore, according to the method of this application embodiment, by recording the position information of the original images inserted in the tabs one by one in the first data list, the cells containing multiple original images can be determined. This avoids the situation where multiple original images displayed in a single cell are identified as one image when directly identifying images from the display page of the Excel file, thereby accurately identifying the cells containing multiple original images. Furthermore, by recording the first data list for each tab in the Excel file containing the target image, multiple original images existing in the same cell on each tab containing the target image in the Excel file can be marked.
[0156] Figure 6 The diagram shown is a partial flowchart of an image extraction method from an Excel file according to an embodiment of this application.
[0157] In one implementation of S104, the electronic device executes... Figure 6 The following steps are shown to identify the original image that appears repeatedly in different cells on a tab.
[0158] S600, construct a second data list, which corresponds to a tab in the Excel file containing the original image.
[0159] In one embodiment, the list items of the second data list include an original image item and a second repetition count item. The original image item is used to record the identification information of the original image (e.g., the file name or number of the original image), and the second repetition count item is used to record the number of times the original image is displayed.
[0160] Specifically, in one embodiment, the original image item is the original image number (rId, rld is the original image number in the first folder). The second repetition count item is repeat_num, where num is a variable value. A null value for the repetition count item represents repeat_0.
[0161] Furthermore, in one embodiment, a single column (rId, repeat_num) is used to record the original image item and the second repetition count item.
[0162] S610, obtain the identification information of the original image inserted in the tab corresponding to the second data list.
[0163] In one embodiment, the first folder is parsed to obtain the number of the corresponding original image in the first folder, and the number of the original image is used as the identification information of the original image recorded in the original image item in the second data list.
[0164] S620, compare whether the identification information already saved in the original image item of the second data list already exists for the identification information corresponding to the obtained original image.
[0165] If the identification information corresponding to the obtained original image is not found in the original image item saved in the second data list, execute S621.
[0166] S621, the identification information corresponding to the acquired original image is recorded in the original image item of the second data list, and the value of the corresponding second repetition number item is recorded as 0 (or, not recorded, is an empty value).
[0167] Specifically, in one implementation of S621, the original image number rId is recorded in the location information field, and the second repetition count field is empty.
[0168] If the identification information corresponding to the acquired original image already exists in the original image item of the second data list, execute S622.
[0169] S622, increment the value of the second repetition count item corresponding to the recorded identification information of the original image item in the second data list by 1.
[0170] Repeat steps S610 to S622 until all the identification information of the original images inserted in the tabs is recorded in the second data list.
[0171] In the final second data list, the identifier information corresponding to the second repetition count item being empty (or 0) points to the original image in only one cell in the tab; the identifier information corresponding to the second repetition count item not being empty (or not being 0) points to the original image that exists repeatedly in multiple cells in the tab, and the value of the second repetition count item + 1 is the number of cells containing that original image.
[0172] Furthermore, in one embodiment, a position information item is added to the second data list. The position information item is used to record the position information of the cell on the tab where the original image is inserted. When recording the original image item and refreshing the second repetition count item, the position information of the original image corresponding to the identification information of the original image is recorded in the position information item, so that the cell where the original image appears repeatedly can be recorded.
[0173] Furthermore, by using the same second data list to record each tab in the Excel file that contains the original image, the original image that appears repeatedly in different cells on all tabs in the Excel file can be marked.
[0174] According to the method in the embodiments of this application, marking the original image repeatedly displayed in multiple different cells can accurately describe the display state of the original image in the Excel file.
[0175] Furthermore, according to the method of this application embodiment, by recording the identification information and position information of the original images inserted in the tabs one by one in the second data list, the original images repeatedly displayed in multiple different cells can be determined. This can avoid the situation where multiple cells that display the same image are identified as cells that display different images when directly identifying images from the display page of the Excel file, thereby accurately identifying the original images that repeatedly appear in multiple different cells.
[0176] Furthermore, in one embodiment, to avoid recording confusion, S105 is also executed after S104.
[0177] S105, rename the original image according to the location information of the original image, and save the renamed original image.
[0178] Specifically, in one implementation of S105, the name of the renamed original image includes a combination of any one or more of the following parts:
[0179] Image identifiers are used to distinguish different original images; different original images have different image identifiers.
[0180] Tab labels are used to distinguish different tabs in an Excel file.
[0181] Location description: This describes the display position of the original image on the tab.
[0182] For example, in one embodiment, the renaming format for the original image is rId-sheet-(row,column), where rId is the image number in the first folder, and sheet is the tab number of the original image.
[0183] (row, column) represents the row and column coordinates of the original image on the tab.
[0184] For example, the name of the original image is Image2-sheet3-(2,3), which means that the original image numbered 2 is displayed in the second row and third column of the third tab.
[0185] For example, the name of the original image is Image1-sheet2-(3,5), which means that the original image numbered 1 is displayed in the third row and fifth column of the second tab.
[0186] According to the method of this application embodiment, the original image is renamed based on the location information of the original image. The name of the original image reflects the tab of the original image in the Excel file and its display position in the tab. This can intuitively distinguish different original images, provide a more accurate and comprehensive record of the original images in the Excel file, and facilitate the analysis of the display content of the Excel file by corresponding to the original images.
[0187] Furthermore, because the same original image may be displayed multiple times in different cells within an Excel file, the number of images displayed in the Excel file may differ from the original number of images.
[0188] In response to the above situation, in order to ensure that the number of original images obtained from the Excel file is consistent with the number of images displayed, in one implementation of S105, if the original image is displayed in multiple positions in the Excel file, the original image is saved as multiple image copies, wherein each image copy corresponds to one display position of the original image in the Excel file.
[0189] Furthermore, in order to distinguish different image copies of the same original image, in one embodiment, the name of the renamed original image also includes: the number of repetitions, which describes how many times the original image is repeated in the Excel file at the display position corresponding to the current image copy.
[0190] For example, in one embodiment, the renaming format for the original image is:
[0191] rId-sheet-(row,column)-repeatNum, where rld is the original image number in the first folder, sheet is the tab number of the original image, (row,column) is the row and column coordinates of the original image on the tab, and repeatNum is the number of repetitions.
[0192] The original image is named Image2-sheet1-(2,5), which means that the original image numbered 2 is displayed for the first time in the second row and fifth column of the first tab.
[0193] The original image is named Image2-sheet2-(3,5)-repeat1, which means that the original image numbered 2 is displayed for the second time in the third row and fifth column of the second tab.
[0194] Figure 7 The diagram shown is a partial flowchart of an image extraction method from an Excel file according to an embodiment of this application.
[0195] In one implementation of S104, the electronic device executes... Figure 7 The following steps are shown to rename and save the original image.
[0196] S700, construct the third data list.
[0197] In one embodiment, the list items of the third data list include an original image item, a third repetition count item, a tab item, and a location information item.
[0198] The original image item records the identification information of the original image (e.g., the original image number), the third repetition count item records how many times the original image is repeated in the Excel file, the tab item records the identification information of the tab where the original image is located (e.g., the tab number), and the position information item records the position information of the cell on the tab where the original image is inserted (e.g., the row and column coordinates of the cell in the tab).
[0199] Following S700, the identification information of the original images inserted into each tab, along with the corresponding tab identification information and cell position information, are retrieved one by one according to the tab arrangement order and the insertion order of the original images in the tab, and recorded into the third data list. Specifically, for any original image inserted into a tab, the following steps S710 to S722 are executed.
[0200] S710, obtain the identification information of the original image inserted in the tab corresponding to the third data list, as well as the identification information of the corresponding tab and the position information of the cell.
[0201] S720, compare the original image identification information already saved in the original image item of the third data list to see if the identification information of the acquired original image already exists.
[0202] If the identification information of the obtained original image is not found in the original image identification information already saved in the original image item of the third data list, execute S721.
[0203] S721, the acquired original image identification information, tab identification information and cell position information are recorded into the original image item, tab item and position information item of the third data list, and the value of the corresponding third repetition number item is recorded as 0.
[0204] For example, obtain the original image ID Image2, its corresponding tab ID sheet1, and its row and column coordinates (2,5). If the third data list has not yet recorded any information about Image2, then record the original image ID Image2, its corresponding tab ID sheet1, and its row and column coordinates (2,5), and record the value of the corresponding third repetition count as 0.
[0205] If the original image identification information already saved in the original image item of the third data list contains the identification information of the obtained original image, execute S722.
[0206] S722, the acquired original image identification information, tab identification information and cell position information are recorded into the original image item, tab item and position information item of the third data list, and the value of the corresponding third repetition number item is recorded as the value of the third repetition number item corresponding to the identification information of the previous original image + 1.
[0207] For example, retrieve the original image ID Image2, its corresponding tab ID sheet2, and its row and column coordinates (3,5). This is possible if the third data list already contains information about Image2. For example, the image ID Image2, tab ID sheet1, row and column coordinates (2,5), and the value of the third repetition count is 0.
[0208] Record the original image number Image2, the corresponding tab number sheet2, and the row and column coordinates (3,5), and record the value of the corresponding third repetition number as 0+1.
[0209] S710 to S722 are executed repeatedly according to the tab arrangement order and the insertion order of the original images in the tabs until the identification information of all the original images inserted in the tabs is recorded in the third data list.
[0210] S730 renames and saves the original image based on each row of the record in the completed third data list.
[0211] Specifically, data is read row by row from the third data list. When the value of the repetition count item in a row of data is 0, the original image corresponding to the original image number is named rId-sheet-(row,column) and saved.
[0212] When the value of the repetition count item in a row of data is not 0, copy the original image corresponding to the original image number and name it rId-sheet-(row,column), and name the copied copy as rId-sheet-(row,column).
[0213] Save the data using rId-sheet-(row,column)-repeatNum.
[0214] For example, a row in the third data list records the original image number Image2, the tab number sheet1, the row and column coordinates (2,5), and the repetition count value is 0. Rename the original image with the original image number Image2 to Image2-sheet1-(2,5) and save it.
[0215] In the third data list, a row below the above row records the original image number Image2, the tab number sheet2, the row and column coordinates (3,5), and the repeat count value of 1. Then, copy the previously saved original image named Image2-sheet1-(2,5), rename the copied original image to Image2-sheet2-(3,5)-repeat1, and save it.
[0216] According to the method of this application embodiment, for an original image that is repeatedly displayed in multiple different cells, an image copy corresponding to each cell displaying the image is created. Furthermore, the original image that is repeatedly displayed in multiple different cells is marked by the name of the original image, so that the number of original images saved in the end is consistent with the number of images displayed in the Excel file, thereby providing a more accurate and comprehensive record of the original images in the Excel file, which facilitates the analysis of the displayed content of the Excel file by corresponding to the original images.
[0217] According to the method of this application embodiment, original images can be extracted from an Excel file without loss, and the tab containing the original image and its display position within the tab can be accurately determined. Furthermore, according to the method of this application embodiment, cells in an Excel file containing multiple original images and original images repeatedly displayed in multiple different cells can be accurately marked. Furthermore, according to the method of this application embodiment, a record of original images consistent with the number of images displayed in the Excel file can be provided. Moreover, the naming of the original images indicates the tab containing the original image, its display position within the tab, and whether it is a repeating image in multiple different cells, thereby providing a more accurate and comprehensive record of the original images in the Excel file, facilitating the analysis of the displayed content of the Excel file through the correspondence between the original images and the data.
[0218] In the description of the embodiments of this application, for the sake of convenience, the description is divided into various modules according to their functions. The division of each module is only a logical functional division. When implementing the embodiments of this application, the functions of each module can be implemented in one or more software and / or hardware.
[0219] Specifically, the apparatus proposed in this application can be fully or partially integrated onto a single physical entity, or physically separated. These modules can be implemented entirely in software via processing element calls; entirely in hardware; or partially in software via processing element calls and partially in hardware. For example, the detection module can be a separate processing element or integrated into a chip in the electronic device. The implementation of other modules is similar. Furthermore, these modules can be fully or partially integrated together, or implemented independently. During implementation, each step of the above method or each of the above modules can be completed through integrated logic circuits in the hardware of the processor element or through software instructions.
[0220] For example, these modules can be one or more integrated circuits configured to implement the above methods, such as one or more application-specific integrated circuits (ASICs), one or more digital signal processors (DSPs), or one or more field-programmable gate arrays (FPGAs). Alternatively, these modules can be integrated together as a system-on-a-chip (SOC).
[0221] An embodiment of this application also proposes an electronic device, which includes a memory for storing computer program instructions and a processor for executing the program instructions, wherein when the computer program instructions are executed by the processor, the electronic device is triggered to execute the process described in the embodiment of this application.
[0222] Specifically, in one embodiment of this application, the one or more computer programs are stored in the memory, and the one or more computer programs include instructions that, when executed by the device, cause the device to perform the steps of the method described in the embodiment of this application.
[0223] Specifically, in one embodiment of this application, the processor of the electronic device may be a device-on-a-chip (SoC), which may include a central processing unit (CPU) and may further include other types of processors. Specifically, in one embodiment of this application, the processor of the electronic device may be a PWM control chip.
[0224] Specifically, in one embodiment of this application, the processor may include, for example, a CPU, DSP, microcontroller, or digital signal processor, and may also include a GPU, embedded neural network processing units (NPUs), and image signal processors (ISPs). The processor may also include necessary hardware accelerators or logic processing hardware circuits, such as ASICs, or one or more integrated circuits for controlling the execution of the program of the technical solution of this application. Furthermore, the processor may have the function of operating one or more software programs, which may be stored in a storage medium.
[0225] Specifically, in one embodiment of this application, the memory of the electronic device may be a read-only memory (ROM), other types of static storage devices capable of storing static information and instructions, random access memory (RAM), or other types of dynamic storage devices capable of storing information and instructions. It may also be an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM), or other optical disc storage, optical disc storage (including compressed optical discs, laser discs, optical discs, digital universal optical discs, Blu-ray discs, etc.), magnetic disk storage media, or other magnetic storage devices. Alternatively, it may be any computer-readable medium capable of carrying or storing desired program code in the form of instructions or data structures that can be accessed by a computer.
[0226] Specifically, in one embodiment of this application, the processor and the memory can be combined into a single processing device, or more commonly, they are independent components. The processor executes program code stored in the memory to implement the method described in the embodiments of this application. In specific implementations, the memory can also be integrated into the processor, or it can be independent of the processor.
[0227] Furthermore, the devices, apparatuses, and modules described in the embodiments of this application may be implemented by computer chips or physical entities, or by products with certain functions.
[0228] Those skilled in the art will understand that embodiments of this application can be provided as methods, apparatus, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media containing computer-usable program code.
[0229] In the several embodiments provided in this application, any function, if implemented as a software functional unit and sold or used as an independent product, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application.
[0230] Specifically, one embodiment of this application also provides a computer-readable storage medium storing a computer program that, when run on a computer, causes the computer to execute the method provided in the embodiment of this application.
[0231] An embodiment of this application also provides a computer program product, which includes a computer program that, when run on a computer, causes the computer to perform the method provided in the embodiment of this application.
[0232] The embodiments described in this application are described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (devices), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0233] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0234] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0235] It should also be noted that in the embodiments of this application, "at least one" refers to one or more, and "more than one" refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent the existence of A alone, the simultaneous existence of A and B, or the existence of B alone. A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one of the following" and similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, and c can represent: a, b, c, a and b, a and c, b and c, or a and b and c, where a, b, and c can be single or multiple.
[0236] In this application embodiment, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0237] This application can be described in the general context of computer-executable instructions, such as program modules, that are executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc., that perform a specific task or implement a specific abstract data type. This application can also be practiced in distributed computing environments where tasks are performed by remote processing devices connected via a communication network. In distributed computing environments, program modules can reside in local and remote computer storage media, including storage devices.
[0238] The various embodiments in this application are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the device embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions of the method embodiments.
[0239] Those skilled in the art will recognize that the units and algorithm steps described in the embodiments of this application can be implemented using electronic hardware, computer software, or a combination of electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0240] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the devices, apparatuses, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0241] The above description is merely a specific embodiment of this application. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the protection scope of this application. The protection scope of this application should be determined by the protection scope of the claims.< / xdr:twocellanchor> < / xdr:twocellanchor> < / xdr:twocellanchor>
Claims
1. A method for extracting images from an Excel file, characterized in that, The method is applied to an electronic device, and the method includes: Obtain an Excel file and extract all original images from it, including extracting the original images from a first folder, wherein: the first folder contains all original images inserted into the Excel file; the first folder is obtained by parsing the Excel file; for images that are displayed repeatedly in the Excel file, only one original image is saved in the first folder; Parse all original images in the Excel file and determine the position information of each original image. The position information is used to describe the display position of the original image in the Excel file, wherein the position information includes the position information of the cell where the image is displayed in the Excel file; Based on the position information of each original image, abnormal original images are identified. These abnormal original images include original images appearing repeatedly in different cells and multiple original images existing in the same cell. Identifying abnormal original images includes: identifying multiple original images existing in the same cell from all the original images, and identifying original images appearing repeatedly in different cells from all the original images. A first data list is constructed, with each item containing a position information item and a first repetition count item. The position information item records the position information of the cell where the original image is inserted on the tab, and the first repetition count item records the number of original images displayed in the cell. The position information of the original images inserted in the tab of the Excel file is obtained. The position information is compared with the position information already saved in the first data list to see if the obtained position information already exists. If the obtained position information is not found in the position information already saved in the first data list, the obtained position information is recorded in the first data list, and the value of the first repetition count item corresponding to the obtained position information is recorded as 1. If the obtained position information is found in the position information already saved in the first data list, the obtained position information is compared with the obtained position information in the first data list to see if the obtained position information already exists. The value of the first repetition count item is incremented by 1; if the value of the first repetition count item corresponding to the obtained location information in the first data list is greater than 1, then the cell corresponding to the location information contains multiple original images; a second data list is constructed, the list items of the second data list include an original image item and a second repetition count item, the original image item is used to record the identification information of the original image, and the second repetition count item is used to record the number of times the original image is displayed repeatedly; the identification information of the original image inserted in the tab of the Excel file is obtained; the identification information is compared with the identification information already saved in the second data list to see if the obtained identification information already exists; if the obtained identification information does not exist in the identification information already saved in the second data list, the obtained identification information is recorded in the second data list, and the value of the second repetition count item corresponding to the obtained identification information is recorded as 0 or empty; if the obtained identification information exists in the identification information already saved in the second data list, the value of the second repetition count item corresponding to the obtained identification information in the second data list is incremented by 1; if the value of the second repetition count item corresponding to the obtained identification information in the second data list is greater than or equal to 1, then the original image corresponding to the identification information is repeatedly present in multiple different cells; For the original image that appears repeatedly in different cells, the original image is saved as multiple image copies, each of which corresponds to a display position of the original image in the Excel file.
2. The method according to claim 1, characterized in that, The process of obtaining the Excel file and extracting all original images from it includes: Obtain and parse the Excel file to obtain a composite document, the composite document including a first folder containing the original images inserted in the Excel file; Extract the original images from the first folder and store them according to the set format.
3. The method according to claim 2, characterized in that, The composite document also includes a second folder containing basic information for each tab and a third folder containing image insertion information for the original images inserted in the corresponding tabs; the location information includes the tab position describing the tab containing the original images in the excel file; The process involves parsing all original images in the Excel file and determining the location information of each original image, including: Based on the basic information of the tabs in the second folder, and according to the image insertion information in the third folder, the tab position of the original image is located.
4. The method according to claim 3, characterized in that, The second folder includes multiple tab files storing the basic information, and the multiple tab files are sorted according to a set rule; the third folder includes multiple image files storing the image insertion information, and each image file corresponds to a tab in the Excel file; The step of locating the tab position of the original image based on the image insertion information in the third folder includes: Search each of the tab files to see if there is an image tag; If the image tag exists, then the image file in the third folder corresponding to the tab file containing the image tag is determined according to the sorting of the tab files in the second folder; By integrating the tab files corresponding to all the image files, the correspondence between the original images corresponding to the image files and the tabs in the Excel file is obtained.
5. The method according to claim 4, characterized in that, The image file contains coordinate position information of the original image inserted into the tab of the Excel file; the position information includes the coordinate position information of the original image on the tab of the Excel file; The process involves parsing all original images in the Excel file and determining the location information of each original image, including: Each image file is parsed to determine the coordinate position information of each original image in the image file.
6. The method according to claim 1, characterized in that, The method further includes: The original image is renamed based on its location information, and the renamed original image is saved.
7. The method according to claim 6, characterized in that, The renamed name of the original image includes a combination of any one or more of the following: Image identifiers, which are used to distinguish different original images, and different original images have different image identifiers; Tab identifiers, which are used to distinguish different tabs in the Excel file; Location description, which describes the display position of the original image on the tab.
8. The method according to claim 7, characterized in that, The renamed name of the original image also includes: the number of repetitions, which describes how many times the original image is repeated in the Excel file, corresponding to the current image copy's display position.
9. The method according to claim 7, characterized in that, The step of renaming the original image according to its location information and saving the renamed original image includes: Construct a third data list, wherein the list items of the third data list include an original image item, a third repetition count item, a tab item, and a position information item. The original image item is used to record the identification information of the original image. The third repetition count item is used to record the number of times the original image is displayed. The tab item is used to record the identification information of the tab where the original image is located. The position information item is used to record the position information of the cell on the tab where the original image is inserted. Obtain the identification information of the original image inserted in the tab of the Excel file, the identification information of the tab where the original image was inserted, and the position information of the cell where the original image was inserted; Compare the identification information already saved in the original image item of the third data list to see if the identification information of the obtained original image already exists; If the identification information of the obtained original image is not found in the identification information already saved in the original image item of the third data list, the identification information of the obtained original image, the identification information of the tab into which the original image is inserted, and the position information of the cell into which the original image is inserted are recorded in the original image item, tab item, and position information item of the third data list, and the value of the corresponding repetition count item is recorded as 0. If the identification information of the obtained original image exists in the original image item of the third data list, the identification information of the obtained original image, the identification information of the tab to which the original image is inserted, and the position information of the cell to which the original image is inserted are recorded in the original image item, tab item, and position information item of the third data list. Furthermore, the value of the corresponding third repetition count item is recorded as the value of the third repetition count item corresponding to the identification information of the previous original image + 1. The original image is renamed and saved based on the records in the third data list that have been completed.
10. An electronic device, characterized in that, The electronic device includes a memory for storing computer program instructions and a processor for executing the computer program instructions, wherein when the computer program instructions are executed by the processor, the electronic device is triggered to perform the method steps as described in any one of claims 1-9.
11. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when run on a computer, causes the computer to perform the method as described in any one of claims 1-9.