I'm using a reportviewer in VB.NET.
When the user exports a report to Excel some of the columns get merged and hidden. is it possible to fix this?
Maybe by manipulating some code or a setting somewhere..?
Excel measures columns in pts, Report Viewer will let you measure in inches, pts, etc. If you are using in. in the report for your column widths try adjusting your column widths so that they convert without any rounding issues to pts. This worked for me.
Conversion = 72 pts/inch. So 0.875 inch would convert to a nice even 63 points. Excel will be happy with that.
Here is a conversion calculator: http://dx.sheridan.com/advisor/converter.html
Related
I'm using a PHPExcel Library to Export my database to excel...
I have a value 200010058502 to be exported but it will appear as 2.0001E+11 in the excel file
Any idea how to format this to make the value the same in my database
My PHPExcel code to fetch value from the database:
$objPHPExcel->getActiveSheet()->SetCellValue("J".$xlsRow,$row['acct_no']);
Thank You in advance
This most likely is an Excel display issue, not a PHP issue.
To verify that the number is imported correctly, highlight the cell and check the status bar. It should show the entire number, and not in scientific notation. If it doesn't, ignore the rest of my answer.
Increase the width of your Excel cell to be more than 11 digits wide. Excel will automatically convert numbers to scientific notation that are too large to physically fit in the display. If it still is in scientific notation, change the formatting of the cell (cell->format->number) to show a number with zero decimal places.
I know many discussions have addressed this but I have not found a solution.
I regularly produce worksheets with about 100 records of text and date fields, each of which must be transposed into a 2-column table and printed to a PDF file.
To do this I have been using VBA code which works through the worksheet rows to sequentially: copy/transpose into two columns in a separate worksheet (Template) and then use rng.ExportAsFixedFormat Type:=xlTypePDF to create the PDF file.
It has all been working fine for several years, until someone recently noticed that sometimes the largest field does not show all the text from the Excel cell. It is invariably cut off after about 1000 - 1100 characters.
Many discussions mention that there is a 1024 limit on cell displays, but I thought this only applied to Excel 2003 and before - 2007 should be fine shouldn't it? In any case, I have found it is always possible to manually adjust the Excel field to reveal all of the text (both in the original worksheet and the temporary 2-column Excel table), sometimes totalling more than 2000 characters. Of course, I don't want to manually adjust and print to PDF 100 times on a regular basis. So I used AutoFit: Sheets("Template").Rows("1:18").Selection.EntireRow.AutoFit
Unfortunately this does not seem to duplicate the manual cell expanding that we have tried successfully. None of the cells is merged. All are wrapped and General formatted. I have tried cleaning text entries via Notepad before entry and inserting blank rows with Alt-F (as suggested elsewhere).
If AutoFit will not work, I am thinking maybe I could include some code to set a customised row height for each table by getting the total word count (is there a function?) and setting row height to about 0.8 * number of words - based on initial calculations.
Any ideas please?
I've used a method similar to what you suggested your last paragraph but with a character count instead of a word count. The VBA function is:
len(range("A1").value)
I did it since I had merged cells and they wouldn't autofit.
You'll have to calibrate for your column width, font and font size but from what I've learned there's no exact method. If you set your characters per line factor too high you might cut off a line, too low and you might get a blank line.
I have some code that retrieves data from a SAS Table on a server. I'm trying to chart this data using VBA, without copying it to an Worksheet first (Feeding the recordset directly into the charts)
I've had success so far with this. The problem is, my charts need to have multilevel categorical X axis, and i'm having trouble automating this only with VBA
What I'm trying to get is something like this
http://imgur.com/ElwHwjE (I can't post the image due to lack of reputation)
But so far all my attempts lead to this
http://imgur.com/id7Vua0
I know I can do this if I first make a Pivot Table from my recordset and then build a chart on top of it, but as stated before I'm trying to do this without copying the data into a Sheet.
Also tried messing with TickLabel options (Multilevel and Depth), but so far to no avail.
I've tried everything I could think of, and I have not been able to create a multiple level categorical axis without having the axis data in a worksheet. I've tried various 1D and 2D arrays, with array elements that include various LF, CR, and CRLF characters. I've tried using the worksheet range, then converting XValues to an array, and of course, this broke the axis without providing a usable array.
Bottom line: Excel charts were designed to plot worksheet data, and you can't always get around this requirement. Most of the time I think you shouldn't waste time trying to get around it.
I am uploading a currency rate workbook through a filehandler in VB.net through System.Data.OleDb.OleDbConnection.
When viewing the rates in the Excel sheet, I see 0.55865921787709500000.
Viewing the same rate in the datatable under debug mode, I see 0.55865921787709480000.
Under Excel, the decimal places are set to 20 - seems to just pad out zeroes past decimal position 15.
I've tried reading/writing the cells to a text file (same '500000' result).
Tried saving the workbook as a comma-delimted text file - same '500000' result.
The rate worksheet is created from another web site. I have attempted to add a 16th digit to the worksheet, but it flips back to zero after I move off the cell. I know Excel has a 16-digit precision limit. In this case, it appears to be storing more.
Is there any way to peek at the actual stored value in the workbook - other than examining the datatable?
Excel is retaining more than 15 significant digits - depending on what system created the original Excel document. In this case, the doc was produced by Crystal Reports. The "extra" significant digits can be viewed using the OLEDB connection against the Excel spreadsheet or by viewing it through the Google Docs version of Excel.
In this particular case, I had to make the SQL-stored rates match the spreadsheet. I converted each rate to a decimal and a string. I used the string to locate the period in the rate and start counting consecutive zeroes that appear after the decimal. This count was added to 15 as the number of digits on a system round of the decimal. The rounded number matched the figures shown when viewing the information in Excel.
JasperReports seems to clip too long cells even in excel. As a result there are wrong results when manualy summarized using excel sum function.
For example if 123456.78 is too long it may be clipped to 1234 which is completely unacceptable.
It can be 'fixed' by stretching columns but it is too invasive and doesn't really solve the problem.
How to fix this without modifying report's layout?