Truy cập Sử dụng chức năng Excel C API Bảng 8,21 Ví dụ xlfGetName Tên trở về giá trị thông qua như là. . . Bảng hoạt động: Bất kỳ. Bảng hiện tại: Bất kỳ. giá trị trả về Bất kỳ tờ trong bất kỳ bảng tính định nghĩa trong các cuộc gọi đến xlfSetName cung cấp. Điều này có thể là một giá trị không đổi, mảng, hoặc phạm vi bảng như trong ví dụ này. | Accessing Excel Functionality Using the C API 323 Table Example xlfGetName return values Name passed as. The active sheet The current sheet Value returned TestName Any. Any. SheetS R1C1 R2C2 The definition supplied in the call to xlfSetName. This may be a constant value array or worksheet range as in this example. TestName Sheetl Any. R2C2 RSCS TestName Sheet2 Any. RSCS R4C4 TestName Sheets Any. Sheet1 R2C2 RSCS Name on Sheet2 is masked by name on Sheetl. TestName Any sheet in any other workbook. Any. NAME Sheet1 TestName Sheetl Any. R2C2 RSCS Sheet1 TestName Sheet2 Any. Sheet1 R2C2 RSCS Sheet1 TestName Sheets Any. Sheet1 R2C2 RSCS Sheet1 TestName Any sheet in any other workbook. Any sheet in any other workbook. NAME Sheet1 TestName Any sheet in any other workbook. Book1 Sheetl Sheet2 or Sheets Sheet1 R2C2 RSCS Sheet1 TestName Sheetl Any. R2C2 RSCS Sheet1 TestName Any other sheet in Any. Sheet1 R2C2 RSCS any workbook. 324 Excel Add-in Development in C C As you can see from the above table the behaviour of this function whilst being logical in its own interesting way is a little confusing. Consequently it s best to use the most explicit form of the name as shown at the bottom of the table to avoid ambiguity or the need to check which is the active sheet before interpreting the result. Where the name is defined within the DLL its definition is only accessible as shown at the top of Table . If the name is a worksheet name it must be prefixed with at least the . Where a DLL name was defined as a constant value even where this is a number the function returns a string in which the value is prefixed with . For example if the value 1 was assigned it returns 1 and if the value xyz was assigned it returns xyx . The following C C code example shows an exportable function that wraps up the call to xlfGetName. xloper __stdcall get_name char name xloper p_info_type cpp_xloper Name name InfoType .