W_1. Sle_1. Text=string (ExcelServer. ActiveSheet. Cells (3, 2). The text), for sle_1 w_1 window. The text sheet1 to be obtained within the cell (3, 2) numerical, tip
A Null object reference at line 15 clicked in the event of object m_ open 0 of the main.
CodePudding user response:
O master!!
CodePudding user response:
ExcelServer to create first and then connecttoobject open files, and then read
Write the code all of the building Lord?
CodePudding user response:
refer to the second floor xiajinxian response: ExcelServer to create first and then connecttoobject open file, then read Write the code all of the building Lord? //set up the OLE object OLEObject ExcelServer ExcelServer=create OLEObject ExcelServer. ConnectToNewObject (" excel. Application ") ExcelServer. Workbooks. Open (ls_path, 0, False) ExcelServer. Application. DisplayAlerts=False Excelserver. WorkSheets [1]. Activate W_1. Sle_1. Text=string (ExcelServer. ActiveSheet. Cells (3, 2). The text) CodePudding user response:
W_1. Sle_1. Text=string (ExcelServer. ActiveSheet. Cells (3, 2). value ) CodePudding user response:
PB under full control of the Excel Excel object control Create Excel object OLEObject ExcelServer ExcelServer=Create OLEObject Connection Excel ExcelServer. ConnectToObject (" ", "Excel. Application") //if the Excel is not open, it is new, ExcelServer. ConnectToNewObject (" Excel. Application ") Return value is an Integer, 0 is normal, negative for error code Disconnect the Excel ExcelServer. DisconnectObject () Open the specified workbook ExcelServer. WorkBooks. Open (" c: \ temp \ ll. XLS ") Add a new workbook ExcelServer. WorkBooks. Add Close the workbook ExcelServer. WorkBooks. Close Add a new worksheet ExcelServer. Sheets. The Add Activate the worksheet "sheet3" ExcelServer. ActiveWorkBook. Sheets (" sheet3 "). Select The worksheet Name ExcelServer. ActiveSheet. Name="curriculum" According to Excel window ExcelServer. Application. The Visible=True Change the Excel title bar ExcelServer. Caption="PB application calls Microsoft Excel" The worksheet for another ExcelServer. ActiveWorkBook. SaveAs (" c: \ temp \ 22. XLS ") Give up inventory ExcelServer. ActiveWorkBook. Saved=True Exit Excel ExcelServer. Quit Cell control To cell assignment ExcelServer. Cells (1, 4). The Value=https://bbs.csdn.net/topics/XM (XM) for database field name In line 2 before inserting a row ExcelServer. ActiveSheet. Rows (2) Insert Before the second column inserts a column ExcelServer. ActiveSheet. The Columns (2). Insert Sets the width of the specified column number) (unit: English characters ExcelServer. ActiveSheet. Columns (1). ColumnWidth=5Setting specifies the height (unit: pounds) (set the line height to 1 cm, 1 pound=0.035 cm). ExcelServer ActiveSheet. Rows (1). RowHeight=1/0.035Designated border line width (Borders parameters: 1 - left, 2 - right, 3 -, 4 -, 5 - inclined, 6 - oblique/) ExcelServer. ActiveSheet. Range (" b3: d3 "). The Borders (2) Weight=3 A to I column automatically adjust column width ExcelServer. ActiveSheet. Columns (a: "I"). AutoFit Set up four border line type (graphics.linestyle values: 1 to 7 - fine, 2 - fine, 4 - points, 9 - two thin lines) ExcelServer. ActiveSheet. Range (" b3: d3 ") Borders (2) graphics.linestyle=1 Merge cells ExcelServer. ActiveSheet. Range (" A1: F1 "). MergeCells=True Copy the entire worksheet ExcelServer. ActiveSheet. UsedRange. Copy Copy the designated area ExcelServer. ActiveSheet. Range (" A1: E2 "). Copy Paste ExcelServer. WorkSheet (" Sheet2 "). The Range (" A1 "). The PasteSpecial Set Font ExcelServer. ActiveSheet. Cells (2, 1). The Font Name="bold" Set the Font Size ExcelServer. ActiveSheet. Cells (1, 1). The Font Size=25 Set the Font to Italic ExcelServer. ActiveSheet. Cells (1, 1). The Font. Italic=True Set a whole column to Bold Font ExcelServer. ActiveSheet. Columns (1). The Font, Bold=True Set a whole column horizontal center ExcelServer. ActiveSheet. Columns (1). The HorizontalAlignment=3 Set a whole line Font color ExcelServer. ActiveSheet. Rows (1). The Font. ColorIndex=4 Set a whole line background ExcelServer. ActiveSheet. Rows (2) Interior. ColorIndex=5 Set a whole line of text in a cell line wrap ExcelServer. ActiveSheet. Row (1) WrapText=True Clear cell formula ExcelServer. ActiveSheet. Cells (1, 4). ClearContents Print relevant Set the header ExcelServer. ActiveSheet. PageSetup. CenterHeader="statements 1 "Set the footer ExcelServer. ActiveSheet. PageSetup. CenterFooter="first page & P "Set the header to the top margin is 2 cm ExcelServer. The ActiveSheet. PageSetup. HeaderMargin 2/0.035= Set the footer exactly margins to 3 cm ExcelServer. ActiveSheet. PageSetup. FooterMargin 3/0.035= Set the top margin to 2 cm ExcelServer. ActiveSheet. PageSetup. TopMargin 2/0.035= Set bottom to 4 cm ExcelServer. ActiveSheet. PageSetup. BottomMargin 4/0.035= Set the left margin is 2 cm ExcelServer. ActiveSheet. PageSetup. LeftMargin 2/0.035= Set the right margin is 2 cm ExcelServer. ActiveSheet. PageSetup. RightMargin 2/0.035= Settings page horizontal center ExcelServer. ActiveSheet. PageSetup. CenterHorizontally=True Settings page vertical center ExcelServer. ActiveSheet. PageSetup. CenterVertically=True Settings page paper size 8 (1 - narrow line 5 11 39 - line 11) 14 ExcelServer. ActiveSheet. PageSetup. PaperSize=1 Insert a page break before line 18 ExcelServer. Worksheets (" Sheet1 "). The Rows (18) PageBreak=1 Delete a page break before column 4 ExcelServer. ActiveSheet. Columns (4). PageBreak=0 Printing a cell line ExcelServer. ActiveSheet. PageSetup. PrintGridlines=True Print preview worksheet ExcelServer. ActiveSheet. PrintPreview Print the worksheet ExcelServer. ActiveSheet. PrintOut CodePudding user response:
ExcelServer. ActiveSheet. Cells (3, 2). The text Instead of ExcelServer. ActiveSheet. Cells (3, 2). The value CodePudding user response:
The fifth floor has given Cell control To cell assignment ExcelServer. Cells (1, 4). The Value=https://bbs.csdn.net/topics/XM (XM) for database field name