File Format & Compatibility

How to Fix TXT File Misalignment in SharePoint vs Notepad

Anum MushtaqAnum Mushtaq Oct 21, 2026 869 views

Question details

Fixed-width text files show properly aligned columns when opened locally in Notepad but appear misaligned when viewed in SharePoint, affecting how Excel macros read the data.

How to Fix TXT File Misalignment in SharePoint vs Notepad
Product
SharePoint, Notepad, Excel
Device & OS
not provided
Scenario
Viewing fixed-width text reports online via SharePoint and processing them using Excel macros.
Observed behavior
Columns in the text file shift and lose alignment in the SharePoint online viewer, and Excel macros pull this misaligned formatting instead of the original local layout.
Before you start

Ensure you have a local backup of your original TXT file and remove any confidential or sensitive data before performing testing or sharing sample files.

Solution 1Recommended

Identify and Correct Spacing or Tab Formatting Issues

Determine if the misalignment is caused by tabs instead of spaces, or if it is isolated to specific rows in the SharePoint online viewer.

Differences in how local text editors (like Notepad) and web-based viewers (like SharePoint) render whitespace can cause columns to shift. Web browsers often compress consecutive spaces or use proportional fonts, whereas Notepad uses fixed-width fonts.

1
Check delimiter types locally

Open the file locally in Notepad. Verify if the columns are separated by tabs or spaces. For strict fixed-width alignment on the web, spaces are generally more reliable than tabs.

2
Test with a sample file

Create a new, simplified sample .txt file using only spaces for alignment. Upload this sample to SharePoint to test if the online viewer renders the new formatting correctly.

3
Adjust online spacing manually

If only specific rows are affected, open the misaligned file in the SharePoint online text editor, manually add or remove spaces to align the affected text, and refresh the page to save changes.

Identify and Correct Spacing or Tab Formatting Issues
Macro Data Source Settings: If an Excel macro relies on this file, ensure the macro is configured to parse the text file using strict fixed-width parameters rather than relying on the visual layout rendered by SharePoint.
Handle Fixed-Width Data Seamlessly

Import and Manage Fixed-Width TXT Files in WPS Office

Avoid online formatting glitches by importing your fixed-width text files directly into WPS Spreadsheet. WPS Office accurately parses spaces and columns, ensuring your data remains perfectly aligned without web viewer distortions.

  1. 1. Open WPS Spreadsheet: Launch WPS Office on your computer and open a new or existing Spreadsheet document.
  2. 2. Import the TXT File: Go to the 'Data' tab on the top ribbon, select 'Import Data', and choose your local fixed-width .txt file.
  3. 3. Select Fixed Width option: In the Text Import Wizard, select 'Fixed width' and click 'Next'. You can now manually click to set the column break lines exactly where your data requires them.
  4. 4. Finish the import: Review the data preview. Once it looks properly aligned, click 'Finish' to import your text data cleanly into spreadsheet cells.
Precise Text-to-Columns wizard designed specifically for fixed-width dataFully compatible with Microsoft Excel (.xlsx) formats and spreadsheet macrosLightweight, fast, and highly reliable for local data processing
microsoft office alternative - wps office

Frequently Asked Questions

Why does my TXT file look perfectly aligned in Notepad but not in SharePoint?

Notepad uses a fixed-width font (like Consolas or Lucida Console) by default, meaning every character and space takes up the exact same width. SharePoint's online viewer may use a proportional font or handle whitespace rendering differently, which causes carefully spaced columns to shift.

How does SharePoint's misalignment affect my Excel macros?

If your Excel macro pulls data directly from the SharePoint web environment and SharePoint alters the underlying spacing or encoding, the macro's fixed-width parsing logic will miscount characters, leading to shifted or corrupted data imports.

Can changing tabs to spaces fix the SharePoint alignment issue?

Yes. Mixing tabs and spaces frequently causes rendering inconsistencies across different text editors and web browsers. Using only spaces for padding in a fixed-width TXT file provides much more predictable alignment in web environments.

How can I prevent the online editor from corrupting my TXT file formatting?

Avoid making direct edits to strict fixed-width data files using web-based text editors. Instead, download the file, make your changes locally using a dedicated text editor like Notepad, and then upload the updated version back to your SharePoint library.