Home > front end >  How to make excel is not displayed in scientific notation cell content?
How to make excel is not displayed in scientific notation cell content?

Time:12-03

I use the following code to generate excel file
Var ExcelApp=new ActiveXObject (" Excel. Application ");
Var ExcelSheet=new ActiveXObject (" Excel Sheet ");
Var ExcelActSheet=ExcelSheet. ActiveSheet;
ExcelActSheet. Cells (1, 1). Valuehttps://bbs.csdn.net/topics/="https://bbs.csdn.net/topics/0301052048110201102".
ExcelSheet. SaveAs (" c: \ \ test. XLS ");
ExcelSheet. Application. The Quit ();
But this column is shown in the excel file 3.01052 e+17, double-click the display 301052048110201000
How to make it show the original string 0301052048110201102? Thank you very much!

CodePudding user response:

Add a single try:
ExcelActSheet. Cells (1, 1). Valuehttps://bbs.csdn.net/topics/="' 0301052048110201102";

CodePudding user response:

Adding a single quotes, you can!

CodePudding user response:

Thank you, have found a way to solve the
1. ExcelSheet. ActiveSheet. Cells (the row, col.) NumberFormatLocal="@";//set the cell formatting to text format
2. ExcelActSheet. Cells (1, 1) Valuehttps://bbs.csdn.net/topics/="' 0301052048110201102";
Both methods can, but after the second method in the selected cell or data can be seen inside the single quotes, so I recommend to use the first way, set his cell format, but it needs to be set up here to set the cell format, and then to assign a value
  • Related