How to set horizontal lines and dotted borders in Excel tables
Explain how to create horizontal lines in Excel tables, distinguish between grid lines, solid borders and dotted borders, give the steps for adding horizontal lines, and explain how to check and restore the dotted borders after they disappear.
Key points of this article
- To add horizontal lines to data rows, use the cell border function first. The line will follow the cell, which is more stable than manual line drawing.
- Excel's default light gray grid lines are usually not printed. To make the table print lines, you must set a real border for the area.
- Dotted line is the line type attribute of the border. When setting the border, select the dotted line type and apply it to the target position.
- The disappearance of the dotted line is most likely due to the line type being changed to None, adjacent cell border conflicts, or conditional formatting coverage. You can retrieve it by checking each item one by one.
When making tables in Excel, you often encounter two situations: you want to add a horizontal line to certain rows, or the originally set dotted border suddenly disappears. Many people subconsciously look for the "line drawing" tool, but the drawn lines are misaligned and disappear when printed.
This article is written for those who need to organize quotations, attendance sheets, experimental data or forms to be filled out. After reading, you will be able to distinguish the difference between grid lines and borders, use the border function to add solid or dotted horizontal lines to cells, and find the reason why the dotted line disappears and restore it.
The following operations are based on common Excel functions. If your table comes from a PDF, it will also explain how to convert it to Excel first and then process it.
How to create horizontal lines in Excel tables? One sentence conclusion
To add a horizontal line to a cell, use the cell border function setting; when a dotted line is required, select dotted line in the line style; only consider inserting line shapes for temporary labeling or decoration.
| your situation | Recommended practices | reason |
|---|---|---|
| Want to have separators between rows of data | Select the row area and add only the lower border | Lines are part of the cell format and follow the content when the rows and columns are adjusted. |
| It is necessary to unify the frame lines of the entire table | Select the entire area and set the outer and inner borders | Once set, the boundaries are aligned and the printing effect is stable |
| Want to use dotted lines to distinguish drafts or parts to be filled in? | First select the dotted line style and then apply it to the target border position | The line type is a border attribute, not an additional graphic |
| Just temporary marking or annotation | Insert straight shape | Shapes are independent of cells and do not move with rows and columns |
| There is a light gray grid on the screen and I want it to be printed. | Add real borders to the area to be printed | Grid lines are not printed by default |
Before you start: Confirm these points first
1. Distinguish grid lines and borders. The light gray fine grid displayed by Excel by default is grid lines, which are mainly used for alignment during editing and are usually not printed. It is different from the border you set. If the lines you see disappear in the print preview, they are probably grid lines.
2. Confirm that the cell range is selected. Select only one cell, and the set border only affects its four sides. If you want a whole row to have horizontal lines, you must first select all the cells in the row. The merged cells must also be selected as a whole, otherwise only a small section of them will be changed.
3. Confirm the source of the form. If the table is copied from a web page or PDF, the lines may be just pictures, text symbols or other objects, and setting the borders directly will cause them to be uneven or even impossible to set. At this time, try to organize the content into standardized cell data first.
4. Make sure the worksheet is not protected. When the worksheet is in protected status, some formats cannot be modified. Protection needs to be removed first; if there is a password, contact the person who created the form to obtain authorization rather than trying to bypass it.
Steps to add horizontal or dashed lines to cells in Excel
- Open the table and use the mouse to drag the cell area that needs to be added with a horizontal line; if you want to select several discontinuous rows, you can hold down the Ctrl key and click one by one.
- Open the Border option in the cell format settings. You can usually right-click a cell and select Format Cells, or you can enter it through the border button on the toolbar.
- Select dashed line or solid line in the line type list, and confirm the line thickness at the same time. Dashed, dotted, and thickness are all selected here.
- Select the location to apply. If you just want to add horizontal lines, select the lower border or the upper border; if you want a whole frame, select the outer border; if you want separation between rows and columns, select the inner border.
- Confirm the effect in the preview area and click OK. If you can’t see clearly in the preview, you can enlarge the worksheet first to check.
- If you only want to draw an independent horizontal line, select the straight line in the insertion shape, hold down the Shift key and drag to draw a horizontal line. This line does not move with the cell and is suitable for temporary labeling.
- Save the file, open print preview, and confirm that the lines appear on the paper as expected.
Check each item after completion
After getting the form, it is recommended to check it according to the table. Most of the "missing thread" problems can be found in these items.
| Check items | How to see | What to do if there is a problem |
|---|---|---|
| Is the line a border or a grid line? | Is there this line in the print preview? | If not, add a real border to the printing area. |
| Whether the dashed line becomes a solid line or disappears | Zoom in to a larger scale to see the line style | Reselect the dashed line style and apply it to the original border position |
| Whether adjacent cells conflict | Check the border settings of the adjacent cells above and below | The lower border of the previous cell and the upper border of this cell will affect each other and can be set uniformly. |
| Are the merged cell boundaries complete? | Click on the merged area to see if the boundaries are continuous | Select the entire merged area and reset the border |
| Whether conditional formatting overwrites the original format | View conditional formatting rules | Adjust rule priority or delete unnecessary rules |
| Is the format lost after copying and pasting? | Compare border style with original table | Use Paste Special to preserve formatting, or reset the borders |
If the line style is set to None, or if the zoom ratio is too small, the dashed lines will appear blurry or appear to have no trace at all. You can usually tell the difference after you zoom in and check.
📊 Core comparison
There are three kinds of things related to "line" in Excel, and they have different characteristics. If you choose the wrong one, you will get the situation that "it is set but not displayed" or "the line is misplaced after moving the table".
| Way | Whether to follow the cell | Can it be printed | Suitable for the scene |
|---|---|---|---|
| grid lines | yes | Usually do not print | Align data while editing |
| Cell border (solid or dashed) | yes | Can print | Table structure, row and column separation, and areas to be filled in |
| inserted line shape | no | Can print | Temporary markings and decorative tips |
When organizing tables daily, give priority to using cell borders. Use shape lines only when you need to place them freely and do not want to affect the data structure.
❓ Frequently Asked Questions (FAQ)
1. The dotted border is set but not printed out. What should I do?
Look at the print preview first to confirm that this area is within the printing range. If the color of the dotted line is very light or the line is very thin, it is usually clearer to print again with a slightly thicker dotted line.
2. The table in PDF has no lines, how to convert it to Excel with borders?
If the PDF itself has clear table lines, you can use the PDF editing function of the OmniDoc desktop client to export it to Excel, and then check and supplement the borders in Excel. The scanned document needs to be OCR recognized first. After recognition, the numbers must be checked one by one and do not be used directly.
3. How to add a unified frame to the entire table at once?
Select the data area of the entire table, set only the outer border, and then add inner borders as needed. In this way, the thickness and line type of the outer frame and internal lines are unified, which is more trouble-free than setting them line by line.
4. The table copied from the web page has no borders, what should I do?
The formatting of web tables usually does not carry over completely into Excel. You can use Paste Special to retain the text content first, and then reset the borders to the required areas.
📝 Summary
How to make horizontal lines in an Excel table? The core is to use cell borders to set solid or dotted lines, and to distinguish grid lines from borders. After setting, open the print preview and check it again to avoid the problem of disappearing or misaligned lines.


