C # automatic line feed and automatic line adjustment in excel

Source: Internet
Author: User

Set in my program:
MyRng. WrapText = true; // wrap automatically
MyRng. entireRow. autoFit (); // The Row Height is automatically adjusted based on the content. After this setting, the page is displayed incorrectly. For example, if a page is 500 high, if the last line does not wrap automatically, it will appear on this page, but after the line breaks automatically, it is a line that spans two pages, or how can we get the line height after the line breaks automatically, could you help me?

 

The top line of EXCEL contains "format"-"line"-"most suitable row height". If you want to make automatic adjustment for all rows, select one. (The premise is that you can adjust the line feed after the line feed is completed. If the line feed is automatically adjusted first, it will not work !)

 

 

The CELL height can be known (Cell. rowHeight) Ah, before printing, read the CELL height of each row from the beginning, calculate it, and re-set the print. the above is the answer to your question, but I think it is not good. recommendation: 1. Set the print range. When there is a line break that exceeds the print line, EXCEL will print your entire line to the next page. 2. Set the print proportion, adjust the margin, and try to consider the occurrence of line breaks.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.