In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)05/31 Report--
In this article, the editor introduces in detail the "C# how to obtain the coordinate location of the picture in Excel". The content is detailed, the steps are clear, and the details are handled properly. I hope that this article "C# how to obtain the coordinate location of the picture in Excel" can help you solve your doubts.
[program environment]
Reference the Spire.Xls.dll version as follows: 12.2
Method 1: download the Free Spire.XLS for .NET package locally, extract it, and install it to the specified path. After completing the installation, find the Spire.Xls.dll file under the BIN folder under the installation path; then open solution Explorer in Visual Studio, click "reference" and "add reference", and introduce the dll file under the installation path into the VS program.
Method 2: install via NuGet. Open solution Explorer in Visual Studio, click "manage NuGet packages", search for "Free Spire.XLS", and click install.
Or install it through the PM console: Install-Package FreeSpire.XLS-Version 12.2.0
[get the row and column location of the picture]
Here are the detailed steps:
Create an object of the Workbook class.
Call the Workbook.LoadFromFile (string fileName) method to load the Excel file.
Gets the specified worksheet through the Workbook.Worksheets [int] property.
Get the specified picture through Worksheet.Pictures [int].
Get the row and column position of the picture through the ExcelPicture.TopRow property and the ExcelPicture.LeftColumn property.
Finally, the obtained results are output through the System.Console.Write () and System.Console.ReadLine () methods.
The following is the completion code for reference:
C#
Using Spire.Xls;namespace GetImgLocation {class Program {static void Main (string [] args) {/ / load the test document Workbook wb = new Workbook (); wb.LoadFromFile ("test.xlsx"); / / get the second worksheet Worksheet sheet = wb.Worksheets [1] / / get the first picture in the worksheet ExcelPicture picture = sheet.Pictures [0]; / / get the row and column location of the picture string row = picture.TopRow.ToString (); string column = picture.LeftColumn.ToString () / / output the result System.Console.Write ("location: (" + row + "," + column + ")); System.Console.ReadLine ();}
Vb.net
Imports Spire.XlsNamespace GetImgLocation Class Program Private Shared Sub Main (args As String ()) 'load test document Dim wb As New Workbook () wb.LoadFromFile ("test.xlsx")' get the second worksheet Dim sheet As Worksheet = wb.Worksheets (1)'to get the first picture in the worksheet Dim picture As ExcelPicture = sheet.Pictures (0) 'get the line of the picture, Column position Dim row As String = picture.TopRow.ToString () Dim column As String = picture.LeftColumn.ToString () 'output get result System.Console.Write ((Convert.ToString (("location: (") & row) + " ") & column) +") System.Console.ReadLine () End Sub End ClassEnd Namespace has read this article, "how to get the coordinate location of the picture in Excel" has been introduced. If you want to master the knowledge of this article, you still need to practice and use it before you can understand it. If you want to know more about the article, please follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.