Expand excel column using delphi - delphi

If I have a DBGrid in a form filled with some data and I want to export the the grid to a excel file how can I expand the columns in the excel file depending on the content of the columns.

I think you're looking for the Range.AutoFit method.

Related

Fastreport select fields to print

I have a report where I would like to select which field of database to show/print and hide all unselected field.I had seen in Fastreport demo but its only Choosing records to print. By the way i'm using dbexpress connection and firebird for database.
Any one who has some ideas about this?
Another simple solution would be to solve it on Delphi itself, before calling your Report.
Just add a calculated field to your dataset, and make it return the content of the real field that you want to show on your report. Now you can link your Report to that calculated field, and each time it will present the field that you have selected to present.

Delphi - How to get a image for a cxGrid column?

I have a TcxGrid component to show data of a MS Access table. One of this columns have a picture. The column "Properties" of this column is marked as "ButtonEdit".
I don't want to use a BlobEdit. I want to create another form, for display this picture. It will be opened by OnButtonClick() event of the grid column. But, I don't know how to get the column content (as TStream or other type), or the column name/field name in the OnButtonClick() event. I can't fix the column name, because it's a "generic" grid for show any Access table.
How can I do it?
It will be nice to understand your question better if you can post your code. But offcourse You can get column contents easily by using FieldByName method. Try to use that.
You did not say how you load the data into the grid, but to get the cell content you can use:
VarAsType(cxGrid1TableView1.DataController.Values[cxGrid1TableView1.Controller.FocusedRecordIndex,cxGrid1TableView1.Controller.FocusedColumnIndex],varString)

How to manage Excel With Delphi 7 using paradox file?

How can I open Excel file in Delphi 7 and move the data to a paradox file?
Using the Ado___ components From the ADO tab.
To "connect" with the file use the TAdoConnection then double-click it, in the provider tab you must select "Microsoft Jet 4.0 OLE DB Provider", in the connection tab you put the name of the file relative to the current directory of your process, in the fourth tab in extended properties you select the version of excel that you want to use.
Note: This connection only works at runtime.
Now you can add an TAdoQuery and link it up with the TAdoConnection, in this query you can use SQL DML statements like select, insert (didn't try this one) and update, delete doesn't work, the only trick is that instead of using table names in the from clause you use excel ranges, for example A range from the A1 cell to to the C10 cell on the sheet MySheet1: [MySheet1$A1:c10], here's the full select for this range:
Select *
From [MySheet1$A1:c10]
You can also use named ranges [MyNamedRangeName$] and entire sheets: [MyEntireSheet$] (notice the mandatory $ after the names).
Now with the data in a dataset you should be able to move it to the paradox dataset.
This about.com article explains in more detail: http://delphi.about.com/od/database/l/aa090903a.htm

How to display and edit hyperlinks in DBGrid in Delphi 7?

I use DBGrid to display Hyperlink type field from Microsoft Access database (MDB).
Normally dbgrid displays hyperlink values like "(MEMO)", without editing capablity. Is there a way to solve this?
DBGrid displays values based on field type. If it shows (MEMO) then you probably declared your field in your database as TEXT or something equivalent. Can't remember Access, but in MS-SQL Server you can change field type to varchar and DBGrid will display values as editable text.

Brio save file without column headings

How can I prevent the column headings from appearing in a .txt save file in Hyperion ?
Here is the answer from Oracle/Hyperion:
You are correct that the headers still appear on the export of the section to .xls format. If you are attempting to export the section and do not want the headers present, you will need to export out as one of the Office Archive formats that are provided (Microsoft Office 2000 HTML (.html) or (.mhtml)). There is no option through the GUI to export a file in the Excel (.xls) format and not have the headers present.
On the main menu bar select Format. In the dropdown, there is an option for 'Column Titles’. Selecting the 'Column Titles' option with uncheck it, removing the column titles from the results.
A workaround, assuming you have no duplicate rows, is to create a Pivot section for the Table/Result set, and bring in every column as a Side Label, and turn off all the Top/Side/Corner labels. Export the Pivot section. Works best if you're pulling in a unique identifier for each row.

Resources