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,027

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



 

ช่วยทีครับ 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)
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Imports System.Data.OleDb
Imports System.IO
Imports System.Data

Public Class FmrptSellGas
    Friend _sellgassid As String = ""
    Private Sub FmrptSellGas_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim Ico As New System.Drawing.Icon("1376639548_Sales-by-Payment-Method-rep.ico")
        Me.Icon = Ico
        Try
            SellGass()
            Me.WindowState = FormWindowState.Maximized
        Catch ex As Exception

        End Try
    End Sub
    Private Sub SellGass()
        '       select tbgoods.goodsname,tbcustomers.cs_name,tbsellgass.sellgassid,tbsellgass.goodsnum,tbsellgass.price,tbsellprice.sellprice,(tbsellgass.price*tbsellgass.goodsnum) as total from(((
        '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}'
        Dim objConn As New OleDbConnection
        Dim objCmd As New OleDbCommand
        Dim dtAdapter As New OleDbDataAdapter
        Dim objCmdCompany As New OleDbCommand
        Dim dtAdapterCompany As New OleDbDataAdapter
        Dim Conn As New OleDbConnection(ConnectDB.ConnectDB)
        Conn.Open()
        Dim ds As New DataSet
        Dim strSQL As String
        Dim dsCompany As New DataSet
        Dim strSQLCompany As String
        Dim dtsellgass, dtcompany As DataTable
        '  strConnString = "Server=localhost;UID=sa;PASSWORD=;database=mydatabase;Max Pool Size=400;Connect Timeout=600;"
        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((("
        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 & "' "

        strSQLCompany = "select companyname,address,phone,fax from tbcompany"
        ' objConn.ConnectionString = strConnString
        With objCmd
            .Connection = Conn
            .CommandText = strSQL
            .CommandType = CommandType.Text
        End With
        dtAdapter.SelectCommand = objCmd
        dtAdapter.Fill(ds)
        dtsellgass = ds.Tables(0)
        With objCmdCompany
            .Connection = Conn
            .CommandText = strSQLCompany
            .CommandType = CommandType.Text
        End With
        dtAdapterCompany.SelectCommand = objCmdCompany
        dtAdapterCompany.Fill(dsCompany)
        dtcompany = dsCompany.Tables(0)
        'dtAdapter = Nothing

        'objConn = Nothing
        ' Dim companynme As String
        ' companynme = dsCompany.Tables("tbcompany")(0).ToString
        Dim rptSellGass As New ReportDocument
        Dim directory As String = My.Application.Info.DirectoryPath
        Dim companyname, address, phone, fax As String
        Dim p As New PrintDialog
        'rpt.Load(directory & "\myCrystalReport1.rpt")
        'rptSellGass.Load("D:\SellGass\STOCK\STOCK\Reports\rptSellGas.rpt")
        companyname = dtcompany.Rows(0)("companyname").ToString
        address = dtcompany.Rows(0)("address").ToString
        phone = dtcompany.Rows(0)("phone").ToString
        fax = dtcompany.Rows(0)("fax").ToString
        rptSellGass.Load(Application.StartupPath & "\rptSellGas.rpt")
        ' rptSellGass.Database.Tables(0).SetDataSource(dtsellgass)
        ' rptSellGass.OpenSubreport("rptCompany").SetDataSource(dsCompany.Tables("tbcompany"))
        rptSellGass.SetDataSource(dtsellgass)
        rptSellGass.SetParameterValue("companyname", companyname)
        rptSellGass.SetParameterValue("address", address)
        rptSellGass.SetParameterValue("phone", phone)
        rptSellGass.SetParameterValue("fax", fax)
        ' rptSellGass.Subreports("rptCompany").Database.Tables(0).SetDataSource(dtcompany)
        'rptSellGass.PrintOptions.PaperSize = PaperSize.DefaultPaperSize
        'Dim objDefaultPrinter As New System.Drawing.Printing.PrinterSettings
        'objDefaultPrinter.PrinterName = "SATO CG208"

        Me.CrystalReportViewer1.ReportSource = rptSellGass
        Me.CrystalReportViewer1.Refresh()
        dtAdapter = Nothing
        Conn.Close()
        Conn = Nothing
    End Sub
End Class


ขอบคุณครับ



Tag : .NET







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2013-10-05 11:34:00 By : hnu25 View : 6219 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)
Dim JimFlag = Reflection.BindingFlags.Instance Or Reflection.BindingFlags.NonPublic
Dim RAWkind As Integer
Dim dp As New System.Drawing.Printing.PrintDocument()
dp.PrinterSettings.PrinterName = "hp officeYet 2500 series" 'Network Printer \\ComputerName\PrinterName

For i As Integer = 0 To dp.PrinterSettings.PaperSizes.Count - 1
    If dp.PrinterSettings.PaperSizes(i).PaperName = "A9 ทั้งใหญ่ทั้งยาว" Then
        RAWkind = CInt(dp.PrinterSettings.PaperSizes(i).GetType().GetField("kind", JimFlag).GetValue(dp.PrinterSettings.PaperSizes(i)))
        Exit For
    End If
Next

rptSellGass.PrintOptions.PaperSize = CType(RAWkind, CrystalDecisions.Shared.PaperSize)
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 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

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