Delphi export to Excel (.xlsx) - delphi

When export to xls there is no error when export to xlsx there is error into cell " the number in this cell is formatted as text or preceded by an apostrophe" but there is no apostrophe
why strange behavior happening?
Update:
I using QExport4XLS, QExport4Xlsx, kbmMemTable - datasource.
MemTable.FieldDefs.Add('Price', db.ftFloat, 0, False)
...
MemTable.FieldByName('Price').AsFloat := Value
...
QExport4X*.DataSet := MemTable;
...
QExport4X*.Execute;

I think this is happening because in both cases (xls and xlsx) you are exporting the values as string. The recent version of Excel, show you that it thinks the cell's value could be of another type by showing you the upper left green triangle.
You should check the type while exporting.
Whitout seeing the code is obviously a wild guess.

I using v4.0 so it was component problem as according their bug fix tracker after v4.2 they did fix.

Related

TListView truncate hints when using styles

I have a problem with TListView when using Application styles.
Sometimes the hints are truncated. It depends on spaces and length of words in the string.
For example:
'1518 ZL Danovy doklad odeslany' is truncated
'1518ZLDaňový doklad odeslaný' ' is OK
This is happening in Delphi 10.2.1! In Delphi XE7, it was all OK! So I think it must be some kind of bug in this version.
Is there any way of fixing it, or a workaround?
ScreenShot of problem:
Simple project:
https://www.dropbox.com/s/q30i9vlejt1vst7/ListViewTest.7z?dl=0
Things I tried:
removing the LVS_EX_INFOTIP flag (with ViewStyle.vsIcon not working):
ListView_SetExtendedListViewStyle(
ListView1.Handle,
ListView_GetExtendedListViewStyle(LV.Handle) and not LVS_EX_INFOTIP
);
Removing the style from TListView as here:
How to disable VCL styles in Delphi

Creating a link to the top of the page for each tab of an excel spreadsheet in SAS using proc report

My goal is to create a mulitab spreadsheet as an output from proc report and have the user able to navigate within each tab using the links I created. This should include going to the top of the page. I am a novice programmer and experiencing
issues with proc report. I try using the footnote statement with success. I received an error message saying "can not open Excel".
Here is my SAS code:
%MACRO rpt_top(COL,TITL,YR) ;;
DATA TMP4;
SET COMBO(WHERE=(VARNAME=&COL));
RUN;
ODS LISTING CLOSE;
ODS EXCEL FILE= "&my_excel_file." STYLE=SASWEB
OPTIONS
(SHEET_NAME ="Test"
SHEET_INTERVAL="NONE" STYLE='SASWEB'
EMBEDDED_TITLES = 'YES' EMBEDDED_FOOTNOTES = 'YES' BOX='YES'
/*TAB_COLOR='GREEN'**/ frozen_headers='6' autofilter='YES' Autofit_height='yes' orientation='Landscape' suppress_bylines='YES');
TITLE1 J=LEFT BOLD "TESTING";
footnote LINK="#'Test'!A4" '(CLICK TO RETURN TO TOP)';
ODS EXCEL OPTIONS
(STYLE='SASWEB' SPLIT='/'
orientation='Landscape' suppress_bylines='YES');
PROC REPORT DATA=TMP4 NOWD;
COLUMNS VARNAME
DEFINE VARNAME /DISPLAY FORMAT=$32. 'LINE NUMBER DESCRIPTION';
RUN;
%MEND;
ODS EXCEL CLOSE will normally automatically open then output file in Excel.
When developing your ODS EXCEL output, you are likely attempting to use the same filename while the prior iteration is still open in Excel. That is when you will see a log message like
ERROR: File is in use, c:\temp\sample.xlsx.
The alert might be slightly different is using Enterprise Guide.
While developing, either be sure to close Excel before rerunning code, or use a incremental output filename.
For example
filename xlout "c:\temp\sample.xlsx"; * for production use;
filename xlout "%sysfunc(pathname(WORK))\sample-%sysfunc(monotonic()).xlsx"; * for development use;
With the incremental filenaming it becomes easier to compare and contrast effects of statements on output.

delphi TClientDataSet utf-8

everybody!
I try to load data into oIntermediateStream in way like that:
oIntermediateStream : TStringStream;
oClient := TClientDataSet.Create(MainOpScr);
oClient.LoadFromStream(oIntermediateStream);
The problem is I want to see one unicode simbol - 'қ'. But I see it in my MSACCESS database like two symbols - 'Т›' ( in windows-1251 encoding).
I suspected something wrong with my base but if I insert this symbol by clipboard I see correct view of my symbol.?
I am looking now on TXMLTransform, but I am not sure it is rigth way?
Could you advise something, please.

wxFileDialog filename textbox appears as clipped

I display an Open File dialog using the following code:
wxFileDialog fileDialog(
this,
wxEmptyString,
"E:\\Testfiles",
"SOME_TEST_FILE_WITH_LONG_NAME.txt",
"TXT files (*.txt)|*.txt",
wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_CHANGE_DIR);
if (fileDialog.ShowModal() == wxID_OK)
{
// do something with the file
}
Notice that I set the default filename to a long string (about 10 or more characters).
When the file dialog is displayed, the filename looks clipped.
But on inspection, it's not really clipped.
More like the starting point of the text is placed too much to the left.
When you place the cursor on the textbox, and scroll to the left, you get the complete filename.
Also, when you switch to a different window then return to the file dialog, it corrects itself and displays the complete filename.
This isn't really affecting the functionality of the file dialog.
This is more of an aesthetic issue.
But if there's a reason for this behavior or if there's a solution, I would like to know.
Thanks!
I'm using:
wxWidgets 3.1.0
Windows 10 Home 64-bit
UPDATE (2017/03/20):
I opened a ticket at wxTrac for this bug.
You can check it here:
http://trac.wxwidgets.org/ticket/17824.
This looks like a bug in wxWidgets, please try to reproduce it in the dialogs sample by making minimal changes to the wxFileDialog call which is already present there and open a ticket on wxTrac with the patch allowing to see the problem, so that someone could debug it.
As a temporary workaround (while an official resolution from wxWidgets is not yet available), calling CenterOnParent() after constructing the file dialog properly "scrolls" the filename so that it won't appear as "clipped".
wxFileDialog fileDialog(
this,
wxEmptyString,
"E:\\Testfiles",
"SOME_TEST_FILE_WITH_LONG_NAME.txt",
"TXT files (*.txt)|*.txt",
wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_CHANGE_DIR);
// fixes the clipped filename
fileDialog.CenterOnParent();
if (fileDialog.ShowModal() == wxID_OK)
{
// do something with the file
}

Change progressbar color

I have a progressbar in my form and I need to change its color. I need it to be Yellow and so I am using this code:
SendMessage(ProgressBar5.Handle, PBM_SETBARCOLOR, 0, clYellow);
I am using Lazarus and I couldn't use the SendMessage(); procedure. Then I have googled a bit and I found that I need to include in the uses the lclintf library.
Now I have another hassle because Lazarus can't recognize the parameter PBM_SETBARCOLOR. In fact it states:
unit5.pas(245,50) Error: Identifier not found "PBM_SETBARCOLOR";
I see that the first line of code that I wrote is the only way to change the color of a ProgressBar from green to the one I need.
Any help? I am using the latest version of Lazarus.
The PBM_SETBARCOLOR is declared in the commctrl.pp unit of freepascal, same as in Delphi.
You could also declare it as a constant with value 1033 (WM_USER + 9).

Resources