.NET Drawing.Printing中自定义PaperSize的问题

银河麒麟V10离线安装VLC播放器:依赖处理与3.0.9.2版本实操指南 在国产化操作系统日益普及的背景下,软件安装方式成为政企内网用户关注的重点。离线安装作为一种不依赖公网源的部署手段,常用于解决内网环境下的软件获取问题。其核心在于理解Linux包管理机制,如dpkg与apt对依赖关系的处理逻辑。掌握这一原理,不仅能应对多媒体软件的部署,也能提升系统维护效率。VLC作为跨平台多媒体播放器,凭借强大的解码能力与协议支持,广泛应用于本地视频播放、RTSP拉流及监控大屏等场景。本文从离线安装的通用概念出发,结合银河麒麟V10桌面版的实际环境,详细梳理了VLC 3.0.9.2离线包的获 阅读详情

以前在做一个项目,需要很多报表,而且报表的格式各不相同,重点是这些格式都是需要自定义的。但是这就碰到一个比较棘手的问题了,用过.net的朋友应该知道,PaperSize的自定义用起来有点问题,反正设置来设置去都实现不了,后来没办法客户催的紧,而且公司也要赶进度,因为客户只需要在两台机子上安装这个报表系统,所以用了一个最笨的方法,在两台机子上先设好需要的报表格式,这样系统才可以顺利使用。其实我分析以后知道如果利用WINDOWS的API在系统中进行设定,应该可以解决这个问题,不过后来转去做其他项目就没时间再考虑如何实现的问题。后来一次在网上看到和我思路一样的一种解决方法,当时就保存下来了。具体的代码如下:
using System;
using System.Text;
using System.Runtime.InteropServices;
using System.Security;
using System.ComponentModel;
using System.Drawing.Printing;

namespace MJMCustomPrintForm
{
    /// <summary>
    /// Summary description for MJMCustomPrintForm.
    /// </summary>
    public class MJMCustomPrintForm
    {
        // Make a static class
        private MJMCustomPrintForm()
        {
        }
   
        [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto)]
            internal struct structPrinterDefaults
        {
            [MarshalAs(UnmanagedType.LPTStr)] public String pDatatype;
            public IntPtr pDevMode;
            [MarshalAs(UnmanagedType.I4)] public int DesiredAccess;
        };

        [DllImport("winspool.Drv", EntryPoint="OpenPrinter", SetLastError=true,
             CharSet=CharSet.Unicode, ExactSpelling=false,CallingConvention=CallingConvention.StdCall),
        SuppressUnmanagedCodeSecurityAttribute()]
        internal static extern bool OpenPrinter([MarshalAs(UnmanagedType.LPTStr)]
            string printerName,
            out IntPtr phPrinter,
            ref structPrinterDefaults pd);
   
        [DllImport("winspool.Drv", EntryPoint="ClosePrinter", SetLastError=true,
             CharSet=CharSet.Unicode, ExactSpelling=false,
             CallingConvention=CallingConvention.StdCall),SuppressUnmanagedCodeSecurityAttribute()]
        internal static extern bool ClosePrinter(IntPtr phPrinter);

        [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto)]
            internal struct structSize
        {
            public Int32 width;
            public Int32 height;
        }

        [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto)]
            internal struct structRect
        {
            public Int32 left;
            public Int32 top;
            public Int32 right;
            public Int32 bottom;
        }

        [StructLayout(LayoutKind.Explicit, CharSet=CharSet.Unicode)]
            internal struct FormInfo1
        {
            [FieldOffset(0), MarshalAs(UnmanagedType.I4)] public uint Flags;
            [FieldOffset(4), MarshalAs(UnmanagedType.LPWStr)] public String pName;
            [FieldOffset(8)] public structSize Size;
            [FieldOffset(16)] public structRect ImageableArea;
        };

        [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Ansi/* changed from CharSet=CharSet.Auto */)]
            internal struct structDevMode
        {
            [MarshalAs(UnmanagedType.ByValTStr, SizeConst=32)] public String
                dmDeviceName;
            [MarshalAs(UnmanagedType.U2)] public short dmSpecVersion;
            [MarshalAs(UnmanagedType.U2)] public short dmDriverVersion;
            [MarshalAs(UnmanagedType.U2)] public short dmSize;
            [MarshalAs(UnmanagedType.U2)] public short dmDriverExtra;
            [MarshalAs(UnmanagedType.U4)] public int dmFields;
            [MarshalAs(UnmanagedType.I2)] public short dmOrientation;
            [MarshalAs(UnmanagedType.I2)] public short dmPaperSize;
            [MarshalAs(UnmanagedType.I2)] public short dmPaperLength;
            [MarshalAs(UnmanagedType.I2)] public short dmPaperWidth;
            [MarshalAs(UnmanagedType.I2)] public short dmScale;
            [MarshalAs(UnmanagedType.I2)] public short dmCopies;
            [MarshalAs(UnmanagedType.I2)] public short dmDefaultSource;
            [MarshalAs(UnmanagedType.I2)] public short dmPrintQuality;
            [MarshalAs(UnmanagedType.I2)] public short dmColor;
            [MarshalAs(UnmanagedType.I2)] public short dmDuplex;
            [MarshalAs(UnmanagedType.I2)] public short dmYResolution;
            [MarshalAs(UnmanagedType.I2)] public short dmTTOption;
            [MarshalAs(UnmanagedType.I2)] public short dmCollate;
            [MarshalAs(UnmanagedType.ByValTStr, SizeConst=32)] public String dmFormName;
            [MarshalAs(UnmanagedType.U2)] public short dmLogPixels;
            [MarshalAs(UnmanagedType.U4)] public int dmBitsPerPel;
            [MarshalAs(UnmanagedType.U4)] public int dmPelsWidth;
            [MarshalAs(UnmanagedType.U4)] public int dmPelsHeight;
            [MarshalAs(UnmanagedType.U4)] public int dmNup;
            [MarshalAs(UnmanagedType.U4)] public int dmDisplayFrequency;
            [MarshalAs(UnmanagedType.U4)] public int dmICMMethod;
            [MarshalAs(UnmanagedType.U4)] public int dmICMIntent;
            [MarshalAs(UnmanagedType.U4)] public int dmMediaType;
            [MarshalAs(UnmanagedType.U4)] public int dmDitherType;
            [MarshalAs(UnmanagedType.U4)] public int dmReserved1;
            [MarshalAs(UnmanagedType.U4)] public int dmReserved2;
        }

      [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto)]
         internal struct PRINTER_INFO_9
      {
         public IntPtr pDevMode;
      }

        [DllImport("winspool.Drv", EntryPoint="AddFormW", SetLastError=true,
             CharSet=CharSet.Unicode, ExactSpelling=true,
             CallingConvention=CallingConvention.StdCall), SuppressUnmanagedCodeSecurityAttribute()]
        internal static extern bool AddForm(
         IntPtr phPrinter,
            [MarshalAs(UnmanagedType.I4)] int level,
         ref FormInfo1 form);

/*    This method is not used
        [DllImport("winspool.Drv", EntryPoint="SetForm", SetLastError=true,
             CharSet=CharSet.Unicode, ExactSpelling=false,
             CallingConvention=CallingConvention.StdCall), SuppressUnmanagedCodeSecurityAttribute()]
        internal static extern bool SetForm(IntPtr phPrinter, string paperName,
            [MarshalAs(UnmanagedType.I4)] int level, ref FormInfo1 form);
*/
        [DllImport("winspool.Drv", EntryPoint="DeleteForm", SetLastError=true,
             CharSet=CharSet.Unicode, ExactSpelling=false,CallingConvention=CallingConvention.StdCall),
        SuppressUnmanagedCodeSecurityAttribute()]
        internal static extern bool DeleteForm(
         IntPtr phPrinter,
            [MarshalAs(UnmanagedType.LPTStr)] string pName);

        [DllImport("kernel32.dll", EntryPoint="GetLastError", SetLastError=false,
             ExactSpelling=true, CallingConvention=CallingConvention.StdCall),
        SuppressUnmanagedCodeSecurityAttribute()]
        internal static extern Int32 GetLastError();

        [DllImport("GDI32.dll", EntryPoint="CreateDC", SetLastError=true,
             CharSet=CharSet.Unicode, ExactSpelling=false,
             CallingConvention=CallingConvention.StdCall),
        SuppressUnmanagedCodeSecurityAttribute()]
        internal static extern IntPtr CreateDC([MarshalAs(UnmanagedType.LPTStr)]
            string pDrive,
            [MarshalAs(UnmanagedType.LPTStr)] string pName,
            [MarshalAs(UnmanagedType.LPTStr)] string pOutput,
            ref structDevMode pDevMode);

        [DllImport("GDI32.dll", EntryPoint="ResetDC", SetLastError=true,
             CharSet=CharSet.Unicode, ExactSpelling=false,
             CallingConvention=CallingConvention.StdCall),
        SuppressUnmanagedCodeSecurityAttribute()]
        internal static extern IntPtr ResetDC(
         IntPtr hDC,
         ref structDevMode
            pDevMode);

        [DllImport("GDI32.dll", EntryPoint="DeleteDC", SetLastError=true,
             CharSet=CharSet.Unicode, ExactSpelling=false,
             CallingConvention=CallingConvention.StdCall),
        SuppressUnmanagedCodeSecurityAttribute()]
        internal static extern bool DeleteDC(IntPtr hDC);

      [DllImport("winspool.Drv", EntryPoint="SetPrinterA", SetLastError=true,
          CharSet=CharSet.Auto, ExactSpelling=true,
          CallingConvention=CallingConvention.StdCall), SuppressUnmanagedCodeSecurityAttribute()]
      internal static extern bool SetPrinter(
         IntPtr hPrinter,
         [MarshalAs(UnmanagedType.I4)] int level,
         IntPtr pPrinter,
         [MarshalAs(UnmanagedType.I4)] int command);

      /*
       LONG DocumentProperties(
         HWND hWnd,               // handle to parent window
         HANDLE hPrinter,         // handle to printer object
         LPTSTR pDeviceName,      // device name
         PDEVMODE pDevModeOutput, // modified device mode
         PDEVMODE pDevModeInput,  // original device mode
         DWORD fMode              // mode options
         );
       */
      [DllImport("winspool.Drv", EntryPoint="DocumentPropertiesA", SetLastError=true,
      ExactSpelling=true, CallingConvention=CallingConvention.StdCall)]
      public static extern int DocumentProperties(
         IntPtr hwnd,
         IntPtr hPrinter,
         [MarshalAs(UnmanagedType.LPStr)] string pDeviceName /* changed from String to string */,
         IntPtr pDevModeOutput,
         IntPtr pDevModeInput,
         int fMode
         );

      [DllImport("winspool.Drv", EntryPoint="GetPrinterA", SetLastError=true,
      ExactSpelling=true, CallingConvention=CallingConvention.StdCall)]
      public static extern bool GetPrinter(
         IntPtr hPrinter,
         int dwLevel /* changed type from Int32 */,
         IntPtr pPrinter,
         int dwBuf /* chagned from Int32*/,
         out int dwNeeded /* changed from Int32*/
         );

      // SendMessageTimeout tools
      [Flags] public enum SendMessageTimeoutFlags : uint
      {
         SMTO_NORMAL         = 0x0000,
         SMTO_BLOCK          = 0x0001,
         SMTO_ABORTIFHUNG    = 0x0002,
         SMTO_NOTIMEOUTIFNOTHUNG = 0x0008
      }
      const int WM_SETTINGCHANGE = 0x001A;
      const int HWND_BROADCAST = 0xffff;

      [DllImport("user32.dll", SetLastError=true, CharSet=CharSet.Auto)]
      public static extern IntPtr SendMessageTimeout(
         IntPtr windowHandle,
         uint Msg,
         IntPtr wParam,
         IntPtr lParam,
         SendMessageTimeoutFlags flags,
         uint timeout,
         out IntPtr result
         );
     
      public static void AddMjm80MmPaperSizeToDefaultPrinter()
      {
         AddCustomPaperSizeToDefaultPrinter("MJM 80mm * Receipt Length", 80.1f, 4003.9f);
      }

      public static void AddMjm104MmPaperSizeToDefaultPrinter()
      {
         AddCustomPaperSizeToDefaultPrinter("MJM 104mm * Receipt Length", 104.1f, 4003.9f);
      }

      /// <summary>
      /// Adds the printer form to the default printer
      /// </summary>
      /// <param name="paperName">Name of the printer form</param>
      /// <param name="widthMm">Width given in millimeters</param>
      /// <param name="heightMm">Height given in millimeters</param>
      public static void AddCustomPaperSizeToDefaultPrinter(string paperName, float widthMm, float heightMm)
      {
         PrintDocument pd = new PrintDocument();
         string sPrinterName = pd.PrinterSettings.PrinterName;
         AddCustomPaperSize(sPrinterName, paperName, widthMm, heightMm);
      }

      /// <summary>
      /// Add the printer form to a printer
      /// </summary>
      /// <param name="printerName">The printer name</param>
      /// <param name="paperName">Name of the printer form</param>
      /// <param name="widthMm">Width given in millimeters</param>
      /// <param name="heightMm">Height given in millimeters</param>
        public static void AddCustomPaperSize(string printerName, string paperName, float
            widthMm, float heightMm)
        {
            if (PlatformID.Win32NT == Environment.OSVersion.Platform)
            {
                // The code to add a custom paper size is different for Windows NT then it is
                // for previous versions of windows

                const int PRINTER_ACCESS_USE = 0x00000008;
                const int PRINTER_ACCESS_ADMINISTER = 0x00000004;
                const int FORM_PRINTER =   0x00000002;
           
                structPrinterDefaults defaults = new structPrinterDefaults();
                defaults.pDatatype = null;
                defaults.pDevMode = IntPtr.Zero;
                defaults.DesiredAccess = PRINTER_ACCESS_ADMINISTER | PRINTER_ACCESS_USE;

                IntPtr hPrinter = IntPtr.Zero;

                // Open the printer.
                if (OpenPrinter(printerName, out hPrinter, ref defaults))
                {
                    try
                    {
                  // delete the form incase it already exists
                        DeleteForm(hPrinter, paperName);
                  // create and initialize the FORM_INFO_1 structure
                        FormInfo1 formInfo = new FormInfo1();
                        formInfo.Flags = 0;
                        formInfo.pName = paperName;
                  // all sizes in 1000ths of millimeters
                        formInfo.Size.width = (int)(widthMm * 1000.0);
                        formInfo.Size.height = (int)(heightMm * 1000.0);
                        formInfo.ImageableArea.left = 0;
                        formInfo.ImageableArea.right = formInfo.Size.width;
                        formInfo.ImageableArea.top = 0;
                        formInfo.ImageableArea.bottom = formInfo.Size.height;
                        if (!AddForm(hPrinter, 1, ref formInfo))
                        {
                            StringBuilder strBuilder = new StringBuilder();
                            strBuilder.AppendFormat("Failed to add the custom paper size {0} to the printer {1}, System error number: {2}",
                                paperName, printerName, GetLastError());
                            throw new ApplicationException(strBuilder.ToString());
                        }

                  // INIT
                  const int DM_OUT_BUFFER = 2;
                  const int DM_IN_BUFFER = 8;
                  structDevMode devMode = new structDevMode();
                  IntPtr hPrinterInfo, hDummy;
                  PRINTER_INFO_9 printerInfo;
                  printerInfo.pDevMode = IntPtr.Zero;
                  int iPrinterInfoSize, iDummyInt;


                  // GET THE SIZE OF THE DEV_MODE BUFFER
                  int iDevModeSize = DocumentProperties(IntPtr.Zero, hPrinter, printerName, IntPtr.Zero, IntPtr.Zero, 0);

                  if(iDevModeSize < 0)
                     throw new ApplicationException("Cannot get the size of the DEVMODE structure.");

                  // ALLOCATE THE BUFFER
                  IntPtr hDevMode = Marshal.AllocCoTaskMem(iDevModeSize + 100);

                  // GET A POINTER TO THE DEV_MODE BUFFER
                  int iRet = DocumentProperties(IntPtr.Zero, hPrinter, printerName, hDevMode, IntPtr.Zero, DM_OUT_BUFFER);

                  if(iRet < 0)
                     throw new ApplicationException("Cannot get the DEVMODE structure.");

                  // FILL THE DEV_MODE STRUCTURE
                  devMode = (structDevMode)Marshal.PtrToStructure(hDevMode, devMode.GetType());

                  // SET THE FORM NAME FIELDS TO INDICATE THAT THIS FIELD WILL BE MODIFIED
                  devMode.dmFields = 0x10000; // DM_FORMNAME
                  // SET THE FORM NAME
                  devMode.dmFormName = paperName;

                  // PUT THE DEV_MODE STRUCTURE BACK INTO THE POINTER
                  Marshal.StructureToPtr(devMode, hDevMode, true);

                  // MERGE THE NEW CHAGES WITH THE OLD
                  iRet = DocumentProperties(IntPtr.Zero, hPrinter, printerName,
                           printerInfo.pDevMode, printerInfo.pDevMode, DM_IN_BUFFER | DM_OUT_BUFFER);

                  if(iRet < 0)
                     throw new ApplicationException("Unable to set the orientation setting for this printer.");

                  // GET THE PRINTER INFO SIZE
                  GetPrinter(hPrinter, 9, IntPtr.Zero, 0, out iPrinterInfoSize);
                  if(iPrinterInfoSize == 0)
                     throw new ApplicationException("GetPrinter failed. Couldn't get the # bytes needed for shared PRINTER_INFO_9 structure");

                  // ALLOCATE THE BUFFER
                  hPrinterInfo = Marshal.AllocCoTaskMem(iPrinterInfoSize + 100);

                  // GET A POINTER TO THE PRINTER INFO BUFFER
                  bool bSuccess = GetPrinter(hPrinter, 9, hPrinterInfo, iPrinterInfoSize, out iDummyInt);

                  if(!bSuccess)
                     throw new ApplicationException("GetPrinter failed. Couldn't get the shared PRINTER_INFO_9 structure");

                  // FILL THE PRINTER INFO STRUCTURE
                  printerInfo = (PRINTER_INFO_9)Marshal.PtrToStructure(hPrinterInfo, printerInfo.GetType());
                  printerInfo.pDevMode = hDevMode;

                  // GET A POINTER TO THE PRINTER INFO STRUCTURE
                  Marshal.StructureToPtr(printerInfo, hPrinterInfo, true);

                  // SET THE PRINTER SETTINGS
                  bSuccess = SetPrinter(hPrinter, 9, hPrinterInfo, 0);

                  if(!bSuccess)
                     throw new Win32Exception(Marshal.GetLastWin32Error(), "SetPrinter() failed.  Couldn't set the printer settings");

                  // Tell all open programs that this change occurred.
                  SendMessageTimeout(
                     new IntPtr(HWND_BROADCAST),
                     WM_SETTINGCHANGE,
                     IntPtr.Zero,
                     IntPtr.Zero,
                     MJMCustomPrintForm.SendMessageTimeoutFlags.SMTO_NORMAL,
                     1000,
                     out hDummy);
                    }
                    finally
                    {
                        ClosePrinter(hPrinter);
                    }
                }
                else
                {
                    StringBuilder strBuilder = new StringBuilder();
                    strBuilder.AppendFormat("Failed to open the {0} printer, System error number: {1}",
                        printerName, GetLastError());
                    throw new ApplicationException(strBuilder.ToString());
                }
            }
            else
            {
                structDevMode pDevMode = new structDevMode();
                IntPtr hDC = CreateDC(null, printerName, null, ref pDevMode);
                if (hDC != IntPtr.Zero)
                {
                    const long DM_PAPERSIZE = 0x00000002L;
                    const long DM_PAPERLENGTH = 0x00000004L;
                    const long DM_PAPERWIDTH = 0x00000008L;
                    pDevMode.dmFields = (int)(DM_PAPERSIZE | DM_PAPERWIDTH | DM_PAPERLENGTH);
                    pDevMode.dmPaperSize = 256;
                    pDevMode.dmPaperWidth = (short)(widthMm * 1000.0);
                    pDevMode.dmPaperLength = (short)(heightMm * 1000.0);
                    ResetDC(hDC, ref pDevMode);
                    DeleteDC(hDC);
                }
            }
        }
    }
}

 不过具体在哪里找到的就不记得了。我自己其实还没试过。先记下来以后再用。 

十年芯片资深IC设计工程师面经系列(四)SDC约束 set_driving_cell:当我们的设计是模块级(Block level)的design时,我们的设计前面一般还有其他的设计,那么前面模块的输出便是我们模块的输入,5.1set_false_path:可以单独的时钟或者路径进行约束。set drive :当我们的设计是芯片级(Chip level)的顶层设计时,芯片外围电路要驱动的是负载较大的IO单元,故需要的驱动能力较强,:set_load 是指output端口的负载,设置的值会影响输出到端口的net上的电容,从而影响相应的路径延时。 阅读详情

相关推荐

【技术解析】华为智算中心:昇腾AI算力与无损网络如何驱动大模型训练

本文深入解析了华为智算中心如何通过昇腾AI算力与超融合以太无损网络的协同,驱动千亿参数大模型的高效训练。昇腾NPU提供专用计算引擎,而基于RoCE的无损网络则通过PFC、ECN等技术确保万卡集群间的高带宽、零丢包通信,实现算力利用率最大化,解决大规模AI训练的核心瓶颈。

weixin_29311017的博客 192

终于部分解决了.NET Drawing.Printing中自定义PaperSize的问题

折磨我一周的问题总算解决了现在项目需要打印各种帐单 打印机都是LQ-1600KIII针式打印机因为每种账单大小不同,主要是纸高度不同所以要控制打印一张的打印机卷纸长度 最开始这样设置 printDoc.DefaultPageSettings.PaperSize=newPaperSize("custom",949,300); 不成功 后来想想 是不是打印机必须添加custom这种纸才行呢,...

weixin_30414155的博客 504

个人信息保护合规审计人员(中级)能力测试试卷

本文是关于个人信息保护合规考试的试题解析,内容涵盖《个人信息保护法》相关规定。试卷包含单选题、多选题、判断题、简答题和案例分析题五种题型,总分100分,考试时间120分钟。试题重点考察个人信息处理的基本原则、敏感个人信息处理要求、合规审计流程、个人信息保护影响评估等内容。通过案例分析题详细解析了人脸识别登录、数据共享、跨境传输等场景下的合规要求。参考答案均严格依据《个人信息保护法》等法律法规,为个人信息处理活动提供了明确的合规指引。

qq_41525079的博客 850

C# 中望CAD(AutoCAD 非Com方式)打印PDF

通过C#实现中望CAD的运行中静默打印PDF功能。可以自定义具体打印设备名称、纸张类型、打印样式表、打印范围、着色打印类型等;将using中的“ZwSoft.ZwCAD”改为“Autodesk.AutoCAD”可以应用在AutoCAD开发中。

wang2543311的博客 2294

自学PCB思路 | PCB设计零基础入门-小白适用(附详细入门经验分享)

本人大一在实践课上就听说PCB,被虎的一楞一楞的,不过现在回看,发现其实并没有相信的那么难!想着把自己这一路摸索的学习路线分享一下,当时我是一边摸索一边上手,一把鼻涕一把泪的过来的。如果你想搞硬件或者需要搞硬件,下面是我的入门学习过程,希望可以帮到你。目录前言选择一款设计软件好的入门课程掌握抄板元件采购焊板子烙铁头热风枪自己半设计明确设计需求全设计最后我并非什么大佬,也没法自己去教大家如何画板。

自动化小秋葵的博客 1万+

鸿蒙进阶——HDI及IDL硬件接口IPC框架小结

HDI(Hardware Device Interface):OpenHarmony硬件设备接口,定义系统中跨进程通信的接口,实现服务间的跨进程通信

最美不过,心中有梦,身旁有你! 3904

cad导出pdf_办公神器(四)完全免费cad批量打印软件,支持导出pdf

“集图集规范库,教学视频,方案库,施工技巧等功能于一体,打造建筑人自己的微信平台!关注我们获取更多精彩.点击☝蓝字关注公众号,给你不一样的惊喜!温馨提示:正文共:1086字 11图预计阅读时间 3分钟1软件简介使用环境:AutoCAD2008~2021官方网址:www.msteel.topMSteel批打印软件功能及特点:1、即装即用,无需任何设置2、可批量打印到纸张或PDF...

weixin_39690958的博客 1612

Dify学习-19-EXCEL数据如何建立知识库+知识库的学习ING

Args:"""定义类,继承自类文档字符串说明这个类用于加载Excel文件这个类提供了从Excel文件(.xls和.xlsx)中提取数据并转换为文档列表的功能。处理两种Excel格式保留超链接信息跳过空行将每行数据转换为键值对格式的文档在元数据中保留源文件信息对于.xlsx文件使用openpyxl处理,可以获取更多单元格信息(如超链接);对于.xls文件则使用pandas的xlrd引擎处理。

Claire的博客 3435

.net 打印页面

在.net环境下开发MIS(管理信息系统)时,最终的结果往往需要通过打印机将数据打印出来。有时我们希望能够随心所欲地打印,这就需要针对自己的 系统开发适用的打印模块。事实上,.net框架提供了强大的打印支持,无论是用VB.net还是C#,都能写出自己满意的打印代码。本文将以VB.net 作为示例代码,介绍如何开发打印模块,重点是如何对打印的纸张页面进行设置,包括这样几个方面的问题:纸张类型、页边距

温智星的专栏 3325

PCL 使用点云创建数字高程模型DEM【2025最新版】

使用点云创建数字高程模型DEM,并将结果保存为高程图像。博客长期更新,本文最近更新时间为:2025年9月15日。

点云侠的博客 2294

基于学术研究于NASA官网GPM卫星数据下载详细教程

基于学术研究于NASA官网GPM卫星数据下载详细教程

珞瑜的博客 8655

access的papersize命令_终于部分解决了.NET Drawing.Printing中自定义PaperSize的问题

折磨我一周的问题总算解决了现在项目需要打印各种帐单 打印机都是LQ-1600KIII针式打印机因为每种账单大小不同,主要是纸高度不同所以要控制打印一张的打印机卷纸长度最开始这样设置printDoc.DefaultPageSettings.PaperSize=newPaperSize("custom",949,300);不成功后来想想 是不是打印机必须添加custom这种纸才行呢,所以到打印机和传真...

weixin_31212247的博客 596

药物对接仿真软件:HADDOCK_(5).HADDOCK中蛋白质-配体对接流程

半柔性能量最小化阶段是在刚体能量最小化的基础上,允许配体的部分柔性,通过优化配体的构象来进一步提高对接的准确性。半柔性能量最小化阶段是在刚体能量最小化的基础上,允许配体的部分柔性,通过优化配体的构象来进一步提高对接的准确性。如果是PDB格式,确保文件包含所有必要的原子信息。对接完成后,HADDOCK会生成一系列的输出文件,包括对接后的蛋白质-配体复合物结构文件、能量评分文件和统计分析文件。对接完成后,HADDOCK会生成一系列的输出文件,包括对接后的蛋白质-配体复合物结构文件、能量评分文件和统计分析文件。

kkchenjj的博客 1081

关于使用VB.NET自定义纸张大小

在 VB.NET 中实现自定义纸张大小,核心是使用 `System.Drawing.Printing.PaperSize` 类。customPaper.RawKind = CInt(PaperKind.Custom) ' 设置为自定义类型。' 创建自定义纸张(示例:A3尺寸 297×420mm)' 将毫米转换为百分之一英寸(1英寸=25.4毫米)- 打印机使用 **1/100 英寸** 作为单位。### VB.NET 自定义打印机纸张大小示例。' 设置页边距(单位:百分之一英寸)' 创建自定义纸张对象。

cncbook1979的博客 417

pscad IEEE标准系统搭建说明

pscad IEEE标准系统搭建说明,包含典型的IEEE 9节点、14节点、30节点、39节点和118节点系统。内含标准测试系统的原始数据和潮流结果。

SIMATIC S7-1200, S7-1500 PID 控制[手册]

SIMATIC S7-1200, S7-1500 PID 控制[手册]

.NET 横向打印,自定义纸张的横向打印

C#实现自定义纸张横向打印,设置pdoc.DefaultPageSettings.Landscape为 true的同时,还需要将纸张也旋转一下才能达到横向打印的效果!!

VicentRen's Tech Blog 7855

Devexpress16.2.6破解工具

Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具

【.Net码农】c#打印机设置,取得打印机列表及相应打印机的所有纸张格式

http://www.it610.com/article/1490591.htm c#打印机设置,取得打印机列表及相应打印机的所有纸张格式 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawi

能看代码的CrackLibby 5684

迈瑞BS系列全自动生化分析仪LIS协议接口手册(内含HL7和ASTM)

迈瑞BS系列全自动生化分析仪LIS协议接口手册,内含HL7和ASTM)

打印系统开发(58)——打印系统开发笔记

一、打印控件:   PrintDocument:要打印的对象。   PageSetupDialog:打印设置对话框。   PrintPreviewControl:打印预览控件。   PrintPreviewDialog:打印预览对话框。   PrintDialog:打印对话框。 二、相关软件 我们的产品是基于Adobe来开发的,我们首先得知道这个功能具体是如何实现的,才好调查用我们的产...

qq_34573534的博客 1067

弄了一整天,终于把打印自定义纸张大小搞定了

   长江支流说的办法保留太多了,结果不行,很多类都是他在程序集里自定义的,源码又没公开不过还是要感谢他的提示   今天和小陈搞了一天,他在国外的论坛上看到了一篇文章得到了启示,最后我们在凌晨3点终于把自定义纸张的代码给写出来了,看来必须用API,微软的.NET对打印的支持太菜了现公开我们工作室实现此功能的部分代码using System;using System.Text;using Syste

皮皮的BLOG 1万+

水晶报表自定义打印非完美解决方案 .

最近,项目中要使用水晶报表打印发票,必须用程序自定义纸张,并且设置为默认打印机的默认纸张,但是微软并没有在.NET1.1中给出很好的办法,大家在网上就此问题也是众说纷纭,百度狗狗了许久,终于找到了一个不算很好的办法,有不少不爽之处,但是整体功能上还是可以实现自定义纸张和设纸,这里稍加整理贴出来,但愿能抛砖引玉,以图能有完美的解决方案。 using System;using System...

weixin_33856370的博客 215

Windows打印机API封装

Windows 打印机

lwei3600103的专栏 1566

如何在 Windows NT 和 Windows 2000 中使用自定义页面大小打印

概要 在 Microsoft Windows 95、Windows 98 和 Windows Millennium Edition (Me) 系统上,可以灵活地自定义页面大小。但在运行 Windows NT 和 Windows 2000 的系统上,必须先将所有页面大小定义为页形 (form) 才能使用。本文介绍如何在 Windows NT 和 Windows 2000 上打印自定义页面大小,...

weixin_34060299的博客 227

C# 实现打印机新增自定义页面大小

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] private struct structSize { public Int32 width; public Int32 height; } [StructLay

Huron Studio 2426

打印自定义纸张大小

长江支流说的办法保留太多了,结果不行,很多类都是他在程序集里自定义的,源码又没公开 不过还是要感谢他的提示 今天和小陈搞了一天,他在国外的论坛上看到了一篇文章得到了启示,最后我们在凌晨3点终于把自定义纸张的代码给写出来了,看来必须用API,微软的.NET对打印的支持太菜了 现公开我们工作室实现此功能的部分代码 usingSystem;usingSystem.Text;usingSystem...

威尔软件 974

C#打印页面的纸张设置问题Spread表格控件

这段时间学习spread控件,用到打印设置上边,其他的设置都还好说,但是打印纸张的大小,纸张类型等把我折腾的够呛,找了半天才找到,记录下来备查。 1、打印纸张类型: System.Drawing.Printing.PaperSize pkSize; System.Drawing.Printing.PrintDocument printDoc = new System.Dr...

weixin_30527143的博客 610
上一篇: 一个通过Oracle8i存储过程,返回记录集的程序包(存储过程)
下一篇: sql server存储过程、存储函数的加密、解密
simonllf
博客等级 码龄23年 23粉丝 35原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值