Applies To:
  • CitectSCADA 5.xx, 6.xx, 7.0
  • CitectHMI 5.xx, 6.xx, 7.0


While viewing a trend, I click the Copy to Clipboard button. There's no error, but when I try to paste the data in another application, it indicates the clipboard is empty.



When copying data to the clipboard, an application can indicate the type of data such as bitmap, metafile, or text. If text is specified, it does not work correctly with MS Excel. Excel will paste all the data into a single column. However, if no data type is specified, Excel will correctly recognize the trend data as having comma delimiters and will correctly paste it into multiple columns. Unfortunately, other programs like Windows Notepad and Calc may not even give you the option to paste from the clipboard if the data has no data type specified. For this reason, Citect has a ClipSetMode() function to choose between the two. However, the trend page's export to clipboard button and supporting Cicode are hard-coded to use Excel-compatible mode. It is possible to modify the Include project to use text mode or to prompt the user for the mode each time they copy trends to the clipboard.

Note: Modifying the Include project is not recommended unless it is necessary. Installing Citect service packs or releases may overwrite the Include project files, so it will be necessary to redo any changes. The Include project is not backed up when you back up your project. Please make a copy of any files that you modify in case the changes do not work as expected.

1. In the Citect Project Editor, go to the Edit menu and choose Find User Function

2. Enter the function name: ExportClipButton and click OK

3. Click the Edit button to open it in the Cicode editor

4. To switch from Excel mode to plain text, simply change the line that says INT nClipMode = 2; to INT nClipmode = 1;

5. Or, to prompt the user each time, add the following lines of code just after the line INT iPen;   If you are not using the CSV_Include project, replace the CSV_MessageBox command with the older Message command. See the Citect help for the correct mode numbers to use.

	IF CSV_MessageBox("Clipboard Mode", "Use Excel CSV format?", 4+32) = 6 THEN
nClipMode = 2; // CSV mode for Excel
nClipMode = 1; // Text mode for OpenOffice or Notepad END

6. Save the file and re-compile your project (make sure Incremental Compile is disabled).