Spread 8.0 Documentation
SSSetTypeDate Function
Support Options
DLL Reference > DLL Functions > SSSetTypeDate Function

Glossary Item Box

SSSetTypeDate Function


See Also    ActiveX

Applies To

fpSpread DLL control

Description

Sets the style, format, and minimum and maximum dates for date cells.

Syntax

C

LPSS_CELLTYPE SSSetTypeDate(HWND hWnd, LPSS_CELLTYPE lpCellType, long Style, LPSS_DATEFORMAT lpFormat, LPSS_DATE lpMin, LPSS_DATE lpMax);

C++

LPSS_CELLTYPE TSpread::SetTypeDate(LPSS_CELLTYPE lpCellType, long Style, LPSS_DATEFORMAT lpFormat, LPSS_DATE lpMin, LPSS_DATE lpMax);

Parameters

The following parameters are available:

Parameter Description
hWnd Window handle of the fpSpread control
lpCellType Pointer to structure to contain cell type information
Style Date style
Use the (|) OR operator and combine the following values as indicated:
Constant Description
DS_SPIN Displays spin button to right of date cell, which lets the user change date using the mouse
(The spin button is displayed only if edit mode is on.)
SSS_ELLIPSES Displays an ellipsis (...) when text is too long to fit in the cell
Use one of the following values:
DS_CENTURY Uses full century notation (for example, "1928" instead of "28")
(By default, only the last two digits of the year are displayed.)
DS_DEFCENTURY Uses default Windows century format
Use one of the following values:
DS_DDMONYY Uses DD-MON-YY format
(For example, November 15, 1995 is displayed or entered as 15-NOV-95. When typing the date, the user can type "O" when the cursor is over the middle portion of the date field and the "OCT" portion appears automatically. For the month of July, three key presses are required: first J (JAN), then U (JUN), and finally L (JUL).)
DS_DDMMYY Uses DD-MM-YY format
(For example, November 15, 1995 is displayed or entered as 15-11-95.)
DS_MMDDYY Uses MM-DD-YY format
(For example, November 15, 1995 is displayed or entered as 11-15-95.)
DS_YYMMDD Uses YY-MM-DD format
(For example, November 15, 1995 is displayed or entered as 95-11-15.)
Use one of the following values:
SSS_ALIGN_TOP (Default) Aligns text at the top of cells
SSS_ALIGN_BOTTOM Aligns text at the bottom of cells
SSS_ALIGN_VCENTER Centers text vertically within the cell
Use one of the following values:
SSS_ALIGN_LEFT (Default) Aligns text to the left in the cell
SSS_ALIGN_RIGHT Aligns text to the right in the cell
SSS_ALIGN_CENTER Centers text horizontally within the cell
Use one of the following values:
SSS_TEXTORIENT_VERT_LTR Displays text vertically in the cell and wraps from left to right
SSS_TEXTORIENT_DOWN Rotates text 90 degrees (to "3 o'clock")
SSS_TEXTORIENT_UP Rotates text 270 degrees (to "9 o'clock")
SSS_TEXTORIENT_INVERT Rotates text 180 degrees (to "6 o'clock")
SSS_TEXTORIENT_VERT_RTL Displays text vertically in the cell and wraps from right to left
lpFormat Pointer to structure containing date format parameters
Pass a NULL value instead of passing a pointer to the structure if you want to use the settings specified by the Style parameter or if you want to use the default settings for date format.
lpMin Pointer to date structure defining minimum valid date
Minimum value you can provide for the parameter is "01011000", or January 1, 1000 A.D.
lpMax Pointer to date structure defining maximum valid date
Maximum value you can provide for the parameter is "12319999", or December 31, 9999 A.D.

Remarks

This function is applied to the current sheet setting unless you first call the SSSetSheet function to specify the sheet for which you are calling this function.

This function initializes a structure of the specified type (SS_CELLTYPE). You can use this structure to set an individual cell or block of cells using the SSSetCellType or SSSetCellTypeRange functions.

If you specify the Style parameter to have the DS_CENTURY format, the application displays the year with full century notation. For example, the application displays "1928" instead of "28". When the user types the date into the cell, the cell expects the date value to contain a four-digit year value. If the user does not provide a four-digit year value, when the cell leaves edit mode, the control sends the SSN_INVALIDDATA message.

Note: If your date cell format displays only two-digit years, the control makes an assumption about the four-digit year value that corresponds to the displayed two-digit year value every time the century value is needed. If you choose not to provide four-digit year values and instead let the fpSpread control assume a century value, be aware that the control might extrapolate the century value using the method specified by the SSSetTwoDigitYearMax function or assume the value is Null. You must check the resulting century value to ensure it is the value you intend.

To determine the date format and separator character used in the Spread control, the control uses the values passed in the SS_DATEFORMAT structure. If the structure is not passed to the SSSetTypeDate function, the control looks at the values specified in the Style parameter of the SSSetTypeDate function for the date format and uses the Date separator setting in the Windows Control Panel. If no value is specified in the Style parameter for the date format, the control uses the Date format setting in the Windows Control Panel.

Note: The control does not recognize changes made to the regional Windows settings until you restart your development environment or your application (or perform any operation that unloads and reloads the current control files). For more information about regional settings and Windows operating environments, see Variations in Windows Regional Settings or Options.

The value specified for the lpMax parameter is the maximum valid value for the cell. When the user types or pastes a value larger than the maximum value into the cell, the cell changes the value to the closest valid date. For example, if the maximum valid date is "12311999" and the user types "12122001" the date is changed to "12121999".

Date values larger than the specified maximum value can still be added to the cell in code at run time; when they are added in code, the value is not changed to a valid value and the control does not send any messages. However, the control changes those values to be less than the maximum value the next time the cell is in edit mode. If the cell leaves edit mode with no change to the value, though, the control changes the value back to the invalid value and the control does not send any messages.

The value specified for the lpMin parameter is the minimum valid value for the cell. When the user types or pastes a value smaller than the minimum value into the cell, the cell changes the value to the closest valid date. For example, if the minimum valid date is "01011998" and the user types "12121997" the date is changed to "12121998".

Date values smaller than the specified minimum value can be added to the cell in code at run time. When the are added in code, the value is not changed to a valid value and the control does not send any messages.. However, the control changes those values to be less than the maximum value the next time the cell is in edit mode. If the cell leaves edit mode with no change to the value, though, the control changes the value back to the invalid value and the control does not send any messages.

Return Value

Pointer to the SS_CELLTYPE structure, or NULL if any of the parameters are invalid.

See Also

Variations in Windows Regional Settings or Options
Creating Date Cells

SSSetCellType, SSSetCellTypeRange, SSSetSheet functions

SSN_INVALIDDATA message

SS_DATEFORMAT structure

ActiveX Correspondence

TypeDateCentury, TypeDateFormat, TypeDateMax, TypeDateMin, TypeDateSeparator, TypeSpin properties

© 2002-2014 ComponentOne, a division of GrapeCity. All Rights Reserved.