3 Replies - 5283 Views - Last Post: 09 September 2013 - 11:22 AM Rate Topic: -----

#1 btmcad   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 06-September 13

Create a custom paper size and print from Excel

Posted 09 September 2013 - 08:53 AM

I have written a program in vb.net that dumps data into an excel file and is then printed. Currently, I can print the data on any standard paper size. However, I now need to print the Excel sheet to a custom paper size. I would like to create the new paper size programmatically, but I'm unsure of how to do this.

I've reviewed the msdn documents on the system.drawing.printing.papersize class, but I'm unsure of how to make the connection between that class and my printer.
Any suggestions or help would be greatly appreciated.


thanks
btmcad

Is This A Good Question/Topic? 0
  • +

Replies To: Create a custom paper size and print from Excel

#2 andrewsw   User is offline

  • never lube your breaks
  • member icon

Reputation: 6823
  • View blog
  • Posts: 28,276
  • Joined: 12-December 12

Re: Create a custom paper size and print from Excel

Posted 09 September 2013 - 09:01 AM

If you will be printing it from within Excel then investigate PageSetup.PaperSize or Application.MapPaperSize. Recording Excel Macros can help.

Excel uses about 40 xlPaperSize constants, hopefully yours is one of these. Start Excel and look in the Print dialog to find the details for these.

This post has been edited by andrewsw: 09 September 2013 - 09:07 AM

Was This Post Helpful? 0
  • +
  • -

#3 btmcad   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 06-September 13

Re: Create a custom paper size and print from Excel

Posted 09 September 2013 - 11:16 AM

The xlPapersize constants do not match the size I need to use. I'm actually printing data from Excel to a label in a label printer.

I need some method to create a custom size that can then be used through Excel.
Was This Post Helpful? 0
  • +
  • -

#4 andrewsw   User is offline

  • never lube your breaks
  • member icon

Reputation: 6823
  • View blog
  • Posts: 28,276
  • Joined: 12-December 12

Re: Create a custom paper size and print from Excel

Posted 09 September 2013 - 11:22 AM

Sorry, I don't know how to do that. If it is a sheet of labels (perhaps on A4) you may have to size the rows and columns, and position the data, so that when printing the content falls inside the labels.

I would send the data to Word to print labels.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1