my report is empty - crystal-reports

I'm using vb net 2005. I have created a .xsd dataset with one table and a rpt report.
the dataset is PedidosDataImpresion.xsd with the table DatosPedido.
The rpt form is pedidoimpreso.rpt
this is my code:
Dim DatosImpresion As New PedidosDataImpresion
Dim TablaPrincipal As DataTable = DatosImpresion.DatosPedido
I = 0
TablaPrincipal.Rows.Add(1)
TablaPrincipal.Rows(I).Item("razonsocial") = Me.lblfacturacion.Text
TablaPrincipal.Rows(I).Item("calle") = Me.LblDireccion.Text
TablaPrincipal.Rows(I).Item("colonia") = Me.LblColonia.Text
TablaPrincipal.Rows(I).Item("ciudad") = Me.LblCiudad.Text
TablaPrincipal.Rows(I).Item("estado") = Me.LblEdo.Text
TablaPrincipal.Rows(I).Item("cp") = Me.LblEdo.Text
TablaPrincipal.Rows(I).Item("rfc") = Me.LblRfc.Text
PedidoImpreso.SetDataSource(DatosImpresion)
PedidoImpreso.PrintOptions.PrinterName = Impresora
PedidoImpreso.PrintToPrinter(Copias, True, 1, 1)
i wish to print directly to the printer with no reportviewer first
and the report comes with no data. Can you help me ?

You had to use some third party tool to do it.
What you can do is:
Make a HTML table
Fill Data
Print table on page load (using jQuery)
In case you want report format then you will need report viewer to get itself rendered.

Related

Drill down column chart with highcharts4gwt

I want to drill down column chart but using highcharts4Gwt . I am doing
Array<Data> data1 = series1.dataAsArrayObject();
Data dat = highchartsFactory.createSeriesColumnData();
dat.y(15);
dat = dat.selected(false);
Data drillDownSeries = dat.drilldown("drill");
drillDownSeries.y(5);
drillDownSeries = drillDownSeries.selected(false);
data1.setValue(0, dat);
options.series().addToEnd(series1);
but column gets clicked bydefault. I don't want using json , but by the above way with 2 level. Is there any way to do this?
Thanks,

itextsharp - Problems reading PDFs with 1 column (page1) and 2 columns (page2)

My code below is lost when opening PDF file which has only one column on the front page and more than 1 column on other pages.
Someone can tell me what I'm doing wrong?
Below my code:
PdfReader pdfreader = new PdfReader(pathNmArq);
ITextExtractionStrategy strategy = new SimpleTextExtractionStrategy();
for (int page=1; page <= lastPage; page++)
{
     extractText = PdfTextExtractor.GetTextFromPage(pdfreader, page, strategy);
extractText = Encoding.UTF8.GetString(ASCIIEncoding.Convert(Encoding.Default, Encoding.UTF8, Encoding.Default.GetBytes(extractText)));
    / / ...
}
You use the SimpleTextExtractionStrategy. This strategy assumes that the text drawing instructions in the PDF are sorted by the reading order. In your case that does not seem to be the case.
If you cannot count on the PDF containing drawing operations in reading order but are only using iText text extraction strategies from the distribution, you have to know areas which constitute a single column. If a page contains multiple columns, you have to use RegionTextRenderFilter to restrict to a column and then use the LocationTextExtractionStrategy.
PS: What exactly is your intention in that
extractText = Encoding.UTF8.GetString(ASCIIEncoding.Convert(Encoding.Default, Encoding.UTF8, Encoding.Default.GetBytes(extractText)));
line?

sum field in crystal report

I have two text fields in crystal report, textA and textB.
What if I wanted through the formula editor (not via c# code) set a third field called textTot = textA + textB.
What is the correct crystal report syntax?
Thanks a lot.
The simplist formula is: ToNumber({TableName.TextA}) + ToNumber({TableName.TextB}).
However, it would be a good idea to first test whether the data is numeric (to avoid a runtime error):
Local NumberVar numericA;
Local NumberVar numericB;
If IsNumeric(Trim({textA}))
Then numericA = ToNumber(Trim({textA}))
Else numericA = 0;
If IsNumeric(Trim({textB}))
Then numericB = ToNumber(Trim({textB}))
Else numericB = 0;
numericA + numericB;

Crystal Report 2008 - Memory Full

I am developing a C#/ASP.NET Web project at VS 2010 and it uses Crystal Reports (2008) version 12.3.0.601. Project calls the report and exports it as pdf. Anytime I change something at report design, "Memory Full" error shows up at when page is refreshed. Sometimes it does not give the error, but sometimes i try not to get the error for hours.
I have searched many sites related to the title but had no luck with a solution.
Has anyone ever encountered such error before?
System.Runtime.InteropServices.COMException (0x80041004): Memory full. Failed to export the report. Not enough memory for operation.
Thanks for your help.
For exporting to pdf I recommend you download some pdf printer ie. http://www.cutepdf.com/products/cutepdf/writer.asp
Then you can "print" the report to pdf no problems.
Hope it helps!
I had a similar problem. On my report there are some texts and images. I have read that Crystal Report first converts the JPG, PNG, etc images to BMPs then it shows the report. And converting other image type to BMP consumes much memory. First I tried to convert JPG images to BMP images in my database but then my database became bigger and bigger. Finally I found the solution (thanks to this answer).
Instead of trying to export all pages to PDF file I splitted files, zipped them and download the zip file:
Dim exportOpts As ExportOptions = New ExportOptions()
Dim pdfRtfWordOpts As PdfRtfWordFormatOptions = ExportOptions.CreatePdfRtfWordFormatOptions()
Dim destinationOpts As DiskFileDestinationOptions = ExportOptions.CreateDiskFileDestinationOptions()
Dim intPageCount As Integer = crReportDocument.FormatEngine.GetLastPageNumber(New CrystalDecisions.Shared.ReportPageRequestContext)
Dim pagecount As Integer
pagecount = Int(intPageCount / 100) + 1
Dim sonsayfa As Integer
Dim ilksayfa As Integer
Dim Anadosyaadi As String
Dim foldername As String
Dim foldernameMap As String
Anadosyaadi = Now.ToString("yyyy-MM-dd-hh-mm-ss")
foldername = "C:\inetpub\wwwroot\" + Anadosyaadi
foldernameMap = "./" + Anadosyaadi
If Not Directory.Exists(foldername) Then
Directory.CreateDirectory(foldername)
End If
For li_count As Integer = 1 To pagecount
ilksayfa = (li_count - 1) * 100 + 1
pdfRtfWordOpts.FirstPageNumber = ilksayfa
sonsayfa = li_count * 100
If sonsayfa > intPageCount Then sonsayfa = intPageCount
pdfRtfWordOpts.LastPageNumber = sonsayfa
pdfRtfWordOpts.UsePageRange = True
exportOpts.ExportFormatOptions = pdfRtfWordOpts
exportOpts.ExportFormatType = ExportFormatType.PortableDocFormat
destinationOpts.DiskFileName = foldername + "\" + li_count.ToString + ".pdf"
exportOpts.ExportDestinationOptions = destinationOpts
exportOpts.ExportDestinationType = ExportDestinationType.DiskFile
crReportDocument.Export(exportOpts)
Next
Using zip As ZipFile = New ZipFile
zip.AddDirectory(foldername)
zip.Save(foldername + "\" + Anadosyaadi + ".zip")
End Using
Response.Redirect(foldernameMap + "/" + Anadosyaadi + ".zip")
PS1: I used Ionic.Zip to zip the files. You should add
Imports Ionic.Zip
on top of your source.
PS2: When I restart the server, without doing anything else, I can get 500 pages of PDF from page number 1 to 500. At this time, I think, Crystal Reports uses some memory. Then if I want to get the second 500 pages (I mean from page number 501 to 1000), I see memory full error. Then I can get 300 pages (from 501 to 800). Then another memory full problem and I can get from 801 to 900, etc. That's why I preferred to split 100 pages. Maybe you can change it to another number.

set Datagirdviewcombobox column value in Vb.net

I have datagrid with two datagridviewcombo column, one column is dynamic fill and one has fixed hardcoded values.
The problem is I can't set the value of dynamic GridViewComboBox, when I try to set it generates continues errors.
System.FormateException: DataGridViewComboBoxCell Value is not valid.
My code to load the grid is
Dim dt As DataTable
dt = GetDataTable("Select valuecol,displayCol From mytable") 'GetDataTable gives me datatable
cmbAntibiotics.DataSource = dt
cmbAntibiotics.DisplayMember = "Antibiotics"
cmbAntibiotics.ValueMember = "AntibioticsID"
Dim Index As Integer
Dim dgr As DataGridViewRow
For Each dr As DataRow In dtFromDB.Rows 'This datatable is filled with database
Index = dtFromDB.Rows.Count - 1
GRDAntimicrobials.Rows.Add()
GRDAntimicrobials.Rows(Index).Cells("cmbAntibiotics").Value = dr("AntibioticsID").ToString 'At this point it shows value (1,2,3) rather then showing its display members
GRDAntimicrobials.Rows(Index).Cells("AntibioticsStatus").Value = dr("AntibioticsStatus").ToString
Next
Pls help with me
It seems like you're trying to assign the value to whatever there is on the cell rather than instantiate the object that resides in the cell and then assign its value. I would try something like this:
Dim vComboBoxColumn As DropDownList = DirectCast(GRDAntimicrobials.Rows(index).Cells("cmbAntibiotics"))
vComboBoxColumn.Value = dr("AntibioticsStatus").ToString