-
You can directly make an export function, and the implementation process is as follows:
1. Add an "Export" button;
3. Add the ** to realize the export, as follows:
tryif = 'twwdbgrid'thenbegin turns the cursor into a funnel.
crhourglass;
if not db_ then exit;
if db_ <1 then exit;
false;
excelcount := ;
sheet1 := 'sheet1'];
except
exit;end;
Change the cursor to a preset value.
crdefault;
endelse
finally
end;
-
vari, j: integer;
begin to create an OLE object for Excel.
try to open an excel file.
if not then exit;
try to set up the workspace.
i := 0;
while not query. eof dobegin
j] := "column field").asstring;
end;finally
Close the workspace.
end;finally
Release the OLE object.
You add me q and I tell you.
-
Import and export to Excel
Merge cells, multiple headers.
Tree tables are combined with treegrids
dbgrid virtual column calculation field.
Automatic pagination printing function.
During the print preview, you can drag the mouse to adjust the page margin, line height, and column width, customize the paper size, and support continuous printing.
and many other high-quality functions, so that ejungrid among the high-end controls, ejungrid is a pure delphi control, while providing activex version, our design goal is to allow the majority of software developers to easily and quickly develop professional, high-level software products, so that your software has a convenient and fast input interface, clear and beautiful data display interface, perfect and powerful print preview function, It allows your users to easily adjust the page layout in real time when printing the preview, what you see is what you get, the operation mode is fully compatible with Excel, and the output report is exquisite and elegant 0 2 0 2 0 2 0 2
-
Look at the data in excel, if it is a specific value, then you need to use the orange function to convert it to a specific date value, if it is already a specific date, then as long as you expand the display range of excel, there is no Wu Pai can be envied.
-
Method: Procedure dbgridinfotoexcel(filename, titlecaption: string;
makedatasource: tdatasource; makedbgrid: tdbgrid);
arow, iloop: word;
tryxlsheet := createoleobject('');
xlsheet := ;
**Title. for iloop := 0 to - 1 do
iloop + 1] := ;
Data. arow := 2;
with do
begindisablecontrols;
first;
while not eof do
beginfor iloop := 0 to - 1 do
beginszvalue := fields[iloop].value;
iloop + 1] := szvalue;
end;inc(arow);
next;end;
first;
enablecontrols;
end;try
Exported! ', 'Tips', mb_iconexclamation);
finally
end;except
Excel is not installed on the machine', 'Wrong', mb_ok);
end;end;
Call: Parameter 1: The name of the file to which excel is exported.
Parameter 2: The first row header of excel (this function is removed in this example, so it is empty).
Parameter 3: DataSOUCE connected to dbgrid
Parameter 4: The dbgrid to be exported
dbgridinfotoexcel(afilename, '', adatasource, dbgrid1);
-
Such a long **, I hope it works
-
I won't talk about the buttons added. **As follows: (By the way, the following DM is the name of the data module, if you don't use the data module, you can delete it, you can ask again if you don't know) macro guess.
procedure : tobject);Add to.
Add data. end;procedure : tobject);Debate Brigade Modified.
Modify the data. end;procedure : tobject);Cancel.
beginif 'Are you sure you want to cancel? 'Tips',mb_yesno)=id_yes then
begintry
Cancel the operation. except
There was an error in the system','Tips',64);
end;end;
end;procedure : tobject);Delete.
beginif 'Are you sure you want to delete the current data? 'Sheltered type,'Tips',mb_yesno)=id_yes then
begintry
Deletion of data. The deletion is successful','Tips',64);
except
There was an error in the system','Tips',64);
end;end;
end;procedure : tobject);Save.
beginif 'Do you really save data? 'Tips',mb_yesno)=id_yes then
begintry
Save the commit to the database.
The save was successful','Tips',64);
except
There was an error in the system','Tips',64);
end;end;
end;
-
It seems that the guess can't be realized. It's all about saving Suichang Zheng's boredom in real time. You can say try dbgrid's edithide event or something, and see if the value control shows that the database is not written.
Don't be annoying if you say reloading! Down, down, down! Not technical at all! ** >>>More
procedure : tobject);
vararr:array of array of string; >>>More
function getsqlserverlist(strings:tstrings):boolean;
The function is implemented as follows: >>>More
I can't read your intentions, judging from the use of tdecompressionstream, it is to decompress something. Since it is decompressed, the number of bytes after DS decompresses the original file will not be the size of the original file, and the 9996 in sobeginning) is the size of the original file, or is it the size of the original file after decompression? If it's the size of the original file, then the positioning here is wrong.
In Sibelius 7, it was not easy to adjust the prelude to a vocal piano accompaniment so that there were only piano parts and no singing parts. Here's a detailed step-by-step guide: >>>More