It took a long time to finally solve the problem, recording the idea of solving the problem:Select 26 to solve this problem, the 26 characters {0,a,b,...,y} represent the Arabic numerals {0,1,2,...,25} respectively.If according to our practice, 26 should be a0,52 for B0 and so on.Don't be impatient, when we get such a result, we start to convert, taking A0 as an example:A0 = 1x26^1 +0x26^0= 0x26^1 +26x26^0=z;Similarly for B0:B0 = 2x26^1 +0x26^0= 1x26^1 +26x26^0=az;That is, the high 1 represents
Given a positive integer, return its corresponding column title as appear in an Excel sheet.For example: 1, A 2, B 3, C ... AA, Z Credits:Special thanks to @ifanchu for adding this problem and creating all test cases.public class Solution {public String converttotitle (int n) { char a[]=new char[27]; a[0]= ' A '; for (int i=1;iExcel Sheet Column Title
Msgonlyone, vbinformation, HEADERExit SubEnd IfOn Error Resume NextFor each W1 in worksheets' Attempt clearance with PWord1W1. Unprotect PWord1Next W1On Error GoTo 0Shtag = FalseFor each W1 in worksheets' Checks for all clear shtag triggered to 1 if not.Shtag = Shtag Or W1. ProtectContentsNext W1If Shtag ThenFor each W1 in worksheetsWith W1If. ProtectContents ThenOn Error Resume NextDo ' Dummy do loopFor i = 66:for j = 66:for k = 66For L = 66:for m = 66:for I1 = 66For i2 = 66:for i3 = 66:for I4
This problem, in fact, is not simple. Know is 26 in the system, how can you find the law found +-1 position? The idea is to look for, for example, AaB to the invariant place of the AB expression, and find the recursive type.Class Solution {public: string converttotitle (int n) { string result; while (n >= 1) { n--; Result.push_back (' A ' + (n%)); n/=; } Reverse (Result.begin (), Result.end ()); return result;} ; [Leetcod
When you use C # To adjust the worksheet. Delete of an Excel object to delete the sheet in a file, it is always impossible. Later I found the problem:
By default, when the appliation. Open file is set to false, the system only operates in the background without a macro. In this case, if you only call Delete to delete a file, a dialog box for confirming the deletion is displayed. However, the deletion is no
Given a positive integer, return it corresponding column title as appear in an Excel sheet.
For example:
1-> A
2-> B
3-> C
...
-> Z
-> AA
Solution
10 into the 26 into the system
1.
Public String converttotitle (int n) {
Map
2.
public string convertToTitle1 (int n) {
String result = ' ";
while (n>0) {Result
= (char) ((n-1)%26 + ' A ")
The first step: the design of the table and raw data input.
Open Excel program is a blank table, no need for special design, input table head, name, according to the format of the results table copied over the line. Then enter the results of each course, each score in a cell. Each cell has an address, which is composed of column and row labels, such as "Kaokian" cell address is B2, "physical" in F1, etc. In the input, according to the results provide
Given a positive integer, return its corresponding column title as appear in an Excel sheet.For example: 1, A 2, B 3, C ... AA, Z The essence is to change the 10 binary to 26, but note that the counting code from 1 starts as follows:public class Solution {public String converttotitle (int n) { String res= ""; while (n>0) { res= (char) ((n-1)%26+ ' A ') +res; N= (n-1)/26; } return res
The example in this article describes how C # controls Excel sheet The way it adapts to page width and column width. Share to everyone for your reference, specific as follows:
Read more about C # Interested readers can view the site topics: "C # Operations Excel Skills Summary", "C # XML file Operation Tips Summary", "C # Common control usage Tutorial",
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.