Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,038

HOME > .NET Framework > Forum > ช่วยทีครับ crystal report preview กำหนด Paper size


 

[.NET] ช่วยทีครับ crystal report preview กำหนด Paper size

 
Topic : 101357



โพสกระทู้ ( 72 )
บทความ ( 0 )



สถานะออฟไลน์



ทำการตั้งค่า ทุกอย่างแล้วครับตามรูปเลยครับ แต่พอ crystal report preview ขนาดกระดาษยังเป็น Letter
ไม่ทราบว่ามีวิธีไหม หรือต้องเขียน Code เพิ่มเติม

test1
*รูปนี้ตั้งค่าที่เครื่องปริ้น

test3
*รูปนี้ทำการตั้งค่าที่ Page Setup บน crystal report เรียบร้อย

test2
*รูปนี้พอ crystal report preview ขึ้นมามันกลับกลาย เป็นขนาดแบบ Letter

Code
Code (VB.NET)
01.Imports CrystalDecisions.CrystalReports.Engine
02.Imports CrystalDecisions.Shared
03.Imports System.Data.OleDb
04.Imports System.IO
05.Imports System.Data
06. 
07.Public Class FmrptSellGas
08.    Friend _sellgassid As String = ""
09.    Private Sub FmrptSellGas_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
10.        Dim Ico As New System.Drawing.Icon("1376639548_Sales-by-Payment-Method-rep.ico")
11.        Me.Icon = Ico
12.        Try
13.            SellGass()
14.            Me.WindowState = FormWindowState.Maximized
15.        Catch ex As Exception
16. 
17.        End Try
18.    End Sub
19.    Private Sub SellGass()
20.        '       select tbgoods.goodsname,tbcustomers.cs_name,tbsellgass.sellgassid,tbsellgass.goodsnum,tbsellgass.price,tbsellprice.sellprice,(tbsellgass.price*tbsellgass.goodsnum) as total from(((
21.        'tbsellgass) left outer join tbgoods on tbsellgass.goodsid=tbgoods.goodsid) left outer join tbcustomers on tbsellgass.cs_id = tbcustomers.cs_id) left outer join tbsellprice on tbsellgass.sellgassid=tbsellprice.sellgassid where tbsellgass.sellgassid= '{?sellgassid}'
22.        Dim objConn As New OleDbConnection
23.        Dim objCmd As New OleDbCommand
24.        Dim dtAdapter As New OleDbDataAdapter
25.        Dim objCmdCompany As New OleDbCommand
26.        Dim dtAdapterCompany As New OleDbDataAdapter
27.        Dim Conn As New OleDbConnection(ConnectDB.ConnectDB)
28.        Conn.Open()
29.        Dim ds As New DataSet
30.        Dim strSQL As String
31.        Dim dsCompany As New DataSet
32.        Dim strSQLCompany As String
33.        Dim dtsellgass, dtcompany As DataTable
34.        '  strConnString = "Server=localhost;UID=sa;PASSWORD=;database=mydatabase;Max Pool Size=400;Connect Timeout=600;"
35.        strSQL = "select tbsellgass.sellgassid,tbgoods.goodsname,tbsellgass.goodsnum,tbsellgass.price,tbsellprice.sellprice,(tbsellgass.price*tbsellgass.goodsnum) as total,tbcustomers.cs_name,tbcustomers.cs_address,tbcustomers.cs_phone from((("
36.        strSQL &= "tbsellgass) left outer join tbgoods on tbsellgass.goodsid=tbgoods.goodsid) left outer join tbcustomers on tbsellgass.cs_id = tbcustomers.cs_id) left outer join tbsellprice on tbsellgass.sellgassid=tbsellprice.sellgassid where tbsellgass.sellgassid= '" & Me._sellgassid & "' "
37. 
38.        strSQLCompany = "select companyname,address,phone,fax from tbcompany"
39.        ' objConn.ConnectionString = strConnString
40.        With objCmd
41.            .Connection = Conn
42.            .CommandText = strSQL
43.            .CommandType = CommandType.Text
44.        End With
45.        dtAdapter.SelectCommand = objCmd
46.        dtAdapter.Fill(ds)
47.        dtsellgass = ds.Tables(0)
48.        With objCmdCompany
49.            .Connection = Conn
50.            .CommandText = strSQLCompany
51.            .CommandType = CommandType.Text
52.        End With
53.        dtAdapterCompany.SelectCommand = objCmdCompany
54.        dtAdapterCompany.Fill(dsCompany)
55.        dtcompany = dsCompany.Tables(0)
56.        'dtAdapter = Nothing
57. 
58.        'objConn = Nothing
59.        ' Dim companynme As String
60.        ' companynme = dsCompany.Tables("tbcompany")(0).ToString
61.        Dim rptSellGass As New ReportDocument
62.        Dim directory As String = My.Application.Info.DirectoryPath
63.        Dim companyname, address, phone, fax As String
64.        Dim p As New PrintDialog
65.        'rpt.Load(directory & "\myCrystalReport1.rpt")
66.        'rptSellGass.Load("D:\SellGass\STOCK\STOCK\Reports\rptSellGas.rpt")
67.        companyname = dtcompany.Rows(0)("companyname").ToString
68.        address = dtcompany.Rows(0)("address").ToString
69.        phone = dtcompany.Rows(0)("phone").ToString
70.        fax = dtcompany.Rows(0)("fax").ToString
71.        rptSellGass.Load(Application.StartupPath & "\rptSellGas.rpt")
72.        ' rptSellGass.Database.Tables(0).SetDataSource(dtsellgass)
73.        ' rptSellGass.OpenSubreport("rptCompany").SetDataSource(dsCompany.Tables("tbcompany"))
74.        rptSellGass.SetDataSource(dtsellgass)
75.        rptSellGass.SetParameterValue("companyname", companyname)
76.        rptSellGass.SetParameterValue("address", address)
77.        rptSellGass.SetParameterValue("phone", phone)
78.        rptSellGass.SetParameterValue("fax", fax)
79.        ' rptSellGass.Subreports("rptCompany").Database.Tables(0).SetDataSource(dtcompany)
80.        'rptSellGass.PrintOptions.PaperSize = PaperSize.DefaultPaperSize
81.        'Dim objDefaultPrinter As New System.Drawing.Printing.PrinterSettings
82.        'objDefaultPrinter.PrinterName = "SATO CG208"
83. 
84.        Me.CrystalReportViewer1.ReportSource = rptSellGass
85.        Me.CrystalReportViewer1.Refresh()
86.        dtAdapter = Nothing
87.        Conn.Close()
88.        Conn = Nothing
89.    End Sub
90.End Class


ขอบคุณครับ



Tag : .NET

Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2013-10-05 11:34:00 By : hnu25 View : 6568 Reply : 7
 

 

No. 1



โพสกระทู้ ( 72 )
บทความ ( 0 )



สถานะออฟไลน์


ขนาดกระดาษของผมคือ 9 x 5.5 นิ้วครับ ซึ่งตั้งชื่อเป็น A9 ในรูป
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2013-10-05 11:35:51 By : hnu25
 

 

No. 2



โพสกระทู้ ( 72 )
บทความ ( 0 )



สถานะออฟไลน์


เงียบมาก
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2013-10-06 08:06:19 By : hnu25
 

 

No. 3

Guest


Code (VB.NET)
01.Dim JimFlag = Reflection.BindingFlags.Instance Or Reflection.BindingFlags.NonPublic
02.Dim RAWkind As Integer
03.Dim dp As New System.Drawing.Printing.PrintDocument()
04.dp.PrinterSettings.PrinterName = "hp officeYet 2500 series" 'Network Printer \\ComputerName\PrinterName
05. 
06.For i As Integer = 0 To dp.PrinterSettings.PaperSizes.Count - 1
07.    If dp.PrinterSettings.PaperSizes(i).PaperName = "A9 ทั้งใหญ่ทั้งยาว" Then
08.        RAWkind = CInt(dp.PrinterSettings.PaperSizes(i).GetType().GetField("kind", JimFlag).GetValue(dp.PrinterSettings.PaperSizes(i)))
09.        Exit For
10.    End If
11.Next
12. 
13.rptSellGass.PrintOptions.PaperSize = CType(RAWkind, CrystalDecisions.Shared.PaperSize)
14.Me.CrystalReportViewer1.ReportSource = rptSellGass

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2013-10-06 09:03:32 By : ผ่านมา
 

 

No. 4

Guest


จาก SourceCode ของคุณ บรรทัดที่ 6 เพิ่ม
Imports System.Reflection

Goodluck


[x] ของผมคอมพิวเตอร์เครื่องเดียวควบคุม Printer 16 ตัว (START/STOP)
และสำพันธ์กับ Conveyer (START/STOP)
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2013-10-06 09:15:06 By : ผ่านมา
 

 

No. 5

Guest


ถ้า Crystal Reports คือคำตอบของคุณ
ผม Guide ให้คุณเขียน User Define Function บน Crystal Reports ถ้านึกภาพไม่ออก
มันก็คล้ายฯ กับการเขียน Store Procedure บน MySQL หรือ SQL Server นั่นแหละครับ

ขอให้โชคดีครับ


[x] มีความรู้ด้านโปรแกรมมิ่งอย่างเดียว ทำอะไรไม่ได้หรอกครับ ใครก็ตามชมว่าเราเก่ง ไอ้คนนั้นมันโกหกเรา
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2013-10-06 09:33:17 By : ผ่านมา
 

 

No. 6

Guest


ผมขอบคุณเจ้าของกระทู้เช่นเดียวกันครับ

Dim Ico As New System.Drawing.Icon("1376639548_Sales-by-Payment-Method-rep.ico")

มันทำให้ผมนึกขึ้นได้ว่า ผมจะทำให้รถวิ่ง/วัตถุ (เคลื่อนไหว) ได้อย่างไร
Imports System.Theartding
System.Drawing.Icon("ล้อ" + ตำแหน่งบนฟอร์ม) แค่นี้ก็หลอกตา Users ได้แล้วครับ

ขอบคุณอีกครั้งหนึ่งครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2013-10-06 09:41:58 By : ผ่านมา
 

 

No. 7



โพสกระทู้ ( 72 )
บทความ ( 0 )



สถานะออฟไลน์


ขอบคุณทุกท่านที่ตอบครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2013-10-06 11:47:43 By : hnu25
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : ช่วยทีครับ crystal report preview กำหนด Paper size
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)





ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2025 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่