I am trying to export the crystal report from vb.net code in xx.rpt and xx.pdf file formats.
There were some calculations in the report. In a particular formula field, when I do a multiplication(say 76.38 * 1.08420006), in pdf file the output is correct with 82.81. But in .rpt file it was 8.288.112.418.28 having all decimal places in wrong position.
Kindly help me on this.
Related
our company has a VB6 program that uses crystal report CRAXDRT9.dll v9.2.0.448 to generate report, yes we are using Crystal Report 9.
so today I am trying something new, inserting image into the report from database BLOB field. I have tried putting both bmp and jpg image file into the BLOB field, both of them can successfully show the image in Crystal Report application while editing the rpt file and Preview, or when exporting a pdf file from the Crystal Report application.
However when I put everything to the report system, where there are some job scheduling, submitting stuff, and the last leg was a small VB program that uses the dll to generate the report, everything else was fine, even data from the same table can be shown, but not the image in the final exported pdf file.
May I know if there is any specific settings I have to configure while I perform this type of action?
code excerpt from the VB program I believe is related to report export settings
Set crxReport = New CRAXDRT.Report
.
.
Select Case datPrimaryRS.Fields(conExportTypeColumn)
Case 0 'PDF
crxExportOptions.DestinationType = crEDTDiskFile
crxExportOptions.FormatType = crEFTPortableDocFormat
crxExportOptions.DiskFileName = txtFileName ' grdDataGrid.Columns(conExportPathColumn) & grdDataGrid.Columns(conExportNameColumn)
crxReport.Export False
Frankly, it seemed to me simply choosing pdf export type and export to local disk, I don't see much else, perhaps it is some other settings that are missing?
I have manually pasted a large number of linked pictures into a 2010 Excel spreadsheet using insert picture -> select picture location --> link to file. These pictures are part of a report. I update the pictures using R each quarter, and my report automatically updates. Perfect.
I now need to change the directory where the plots are kept, and need to update the links. As there are around 200 of them (its a big report), I want to do this in VBA. Whilst I can loop through the pictures ok (ActiveSheet.Pictures), I can't seem to find the links/address. Any idea how I can see the underlying file location so I might change it - the reference has to be stored somewhere (note - these don't seem to be stored as hyperlinks).
Any idea how I can see the underlying file location so I might change it - the reference has to be stored somewhere
Create a new folder
Paste a copy of the .xlsx or .xlsm excel file
Uncompress the file with a zip tool (i'm using 7-Zip)
Delete the .xlsx or .xlsm file (optional)
Now we have all the component parts of the original file as plain text xml files and folders
Inside the folder xl\drawings\ _rels there are files named as drawing2.xml.rels, drawing3.xml.rels, ...
It seems that each file corresponds to a sheet and stores the paths to images in this format:
Target="file:///C:\Users\myusername\Documents\MyImageFolder\My%20Image%20Name.png"
Change the paths with a text editor
Compress all the contents of the folder to a .zip
Change the extension to the original .xlsx or .xlsm
These steps could be automated with VBA, AutoIt, etc., here some references:
An example with AutoIt and 7-zip
http://www.jkp-ads.com/Articles/Excel2007FileFormat.asp
http://www.jkp-ads.com/Articles/Excel2007FileFormat02.asp
Ron de Bruin zip examples with VBA
Read and change multiple XML files in Excel (2007) VBA
Excel uses the Formula Bar as the link in this case, just the same as it would link between ranges in two different worksheets. When I select a linked picture, the formula below populates in the formula bar:
=[TrialWB.xlsm]Sheet1!$C$3:$E$6
You can access the Shape's formula using the code below and inserting your picture's specific name:
ActiveSheet.Pictures("Picture Name").Formula = "=[TrialWB.xlsm]Sheet1!$C$4:$E$6"
In updating the links, you'll have to change the file path in the formula. This might look like:
ActiveSheet.Pictures("Picture Name").Formula = "='C:\Reports2015\[TrialWB.xlsm]Sheet1'!$C$4:$E$6"
changing to
ActiveSheet.Pictures("Picture Name").Formula = "='C:\Reports2016\[TrialWB.xlsm]Sheet1'!$C$4:$E$6"
This question may be of some further assistance for accessing formulas:
Excel: create image from cell range
And here's a useful Microsoft page for formula file path editing: https://support.office.com/en-us/article/Create-an-external-reference-link-to-a-cell-range-in-another-workbook-c98d1803-dd75-4668-ac6a-d7cca2a9b95f
I am trying to open a .txt file in excel and keep all the cells as "Text" format. This is because there are values such as "Sept03" and it will convert it to "Sept-03" and when you force "Text" format after it has opened it converts it into number form ruining the data.
There is a lot of files and I need it to be automatic. Anyone have a solution or work-around for this? Can I force excel to open files and have all cells be a particular format before it fully opens?
Thanks!
I've been trying to establish why a number of rtf files (opened and edited by multiple users from a network drive) have seen certain styles convert to Symbol or Wingdings fonts.
One lead I'm investigating is the file encoding (ActiveDocument.TextEncoding), which returns a result of -1 for all files. I couldn't find this on the MS list here. Can anyone tell me what the value of -1 means/translates to, please?
Using Report Designer, when I preview the data in a PDF, the number formatting for PDF is correct in which there is a thousands separator--a comma after 3 digits--but the Excel output has it missing.
Excel - 857320
PDF - 857,320
What changes can be made to the attributes so that the comma is present for the Excel export as well?
Selecting #,##0 in format of the attributes of number-field gets the comma after 3 digits.
It seems in pdf it would work even without this format specification but for excel export it needs to be there.