LogoGLM-OCR
  • Features
  • API Pricing
  • Blog
Complex Table Recognition: How GLM-OCR Handles Merged Cells
2025/01/13

Complex Table Recognition: How GLM-OCR Handles Merged Cells

Learn how GLM-OCR excels at recognizing complex tables with merged cells, multi-level headers, and diverse layouts commonly found in business documents.

Introduction

Table recognition is one of the most challenging tasks in document understanding. GLM-OCR achieves state-of-the-art performance in table recognition, handling complex structures that traditional OCR solutions struggle with.

Challenges in Table Recognition

Traditional OCR systems often fail with:

  • Merged cells: Cells spanning multiple rows or columns
  • Multi-level headers: Nested header structures
  • Borderless tables: Tables without visible grid lines
  • Complex layouts: Mixed text and numerical data
  • Rotated tables: Tables at various angles

GLM-OCR Table Recognition Capabilities

GLM-OCR excels at all these scenarios thanks to its:

  1. CogViT Visual Encoder: Understands spatial relationships
  2. Deep Scene Optimization: Trained on real-world table data
  3. Structured Output: Produces clean Markdown or JSON

Usage

Basic Table Recognition

# Using Ollama
ollama run glm-ocr Table Recognition: ./table.png

API Call

import requests

response = requests.post(
    "https://api.z.ai/api/paas/v4/layout_parsing",
    headers={"Authorization": "Bearer your-api-key"},
    json={
        "model": "glm-ocr",
        "file": "https://example.com/table.png"
    }
)

# Output is structured Markdown table
print(response.json()["content"])

Output Formats

Markdown Output

GLM-OCR outputs tables in clean Markdown format:

| Product | Q1 | Q2 | Q3 | Q4 | Total |
|---------|-----|-----|-----|-----|-------|
| Widget A | 100 | 150 | 200 | 180 | 630 |
| Widget B | 80 | 120 | 140 | 160 | 500 |
| **Total** | **180** | **270** | **340** | **340** | **1130** |

Handling Merged Cells

For tables with merged cells, GLM-OCR preserves the structure:

| Category | | Sales | |
|----------|----------|-------|-------|
| | Product | 2023 | 2024 |
| Electronics | Phone | 1000 | 1200 |
| Electronics | Laptop | 800 | 950 |
| Furniture | Chair | 500 | 600 |

Real-World Examples

Financial Reports

GLM-OCR handles complex financial tables with:

  • Multiple header rows
  • Currency formatting
  • Percentage calculations
  • Footnote references

Academic Papers

Scientific tables often include:

  • Statistical data
  • Confidence intervals
  • P-values
  • Multi-column layouts

Business Documents

Common business table types:

  • Invoice line items
  • Inventory lists
  • Employee records
  • Project timelines

Best Practices

Image Quality

  • Resolution: Minimum 150 DPI recommended
  • Contrast: Ensure clear distinction between text and background
  • Orientation: Correct any rotation before processing

Complex Tables

For very complex tables:

  1. Crop the table: Remove surrounding text
  2. Enhance contrast: Improve visibility of grid lines
  3. Split large tables: Process sections separately if needed

Post-Processing

import pandas as pd
from io import StringIO

# Parse Markdown table to DataFrame
markdown_table = """
| Product | Sales | Revenue |
|---------|-------|---------|
| A | 100 | $1000 |
| B | 200 | $2000 |
"""

# Convert to DataFrame for further processing
df = pd.read_csv(
    StringIO(markdown_table.replace("|", ",")),
    skipinitialspace=True
)

Performance Comparison

FeatureGLM-OCRTraditional OCR
Merged CellsExcellentPoor
Multi-level HeadersExcellentLimited
Borderless TablesGoodPoor
Speed1.86 pages/secVaries
Accuracy94.62 (SOTA)~80-85

Troubleshooting

Common Issues

Issue: Columns misaligned Solution: Ensure the table image is not skewed

Issue: Missing cells Solution: Check image resolution and contrast

Issue: Merged cells not detected Solution: Use higher resolution image

Conclusion

GLM-OCR's table recognition capabilities make it ideal for processing complex business documents, financial reports, and academic papers. Its ability to handle merged cells, multi-level headers, and borderless tables sets it apart from traditional OCR solutions.

Related Articles

  • GLM-OCR Quick Start Guide
  • Formula Recognition with GLM-OCR
  • Information Extraction Guide
All Posts

Author

avatar for GLM-OCR Team
GLM-OCR Team

Categories

  • Feature
  • Tutorial
IntroductionChallenges in Table RecognitionGLM-OCR Table Recognition CapabilitiesUsageBasic Table RecognitionAPI CallOutput FormatsMarkdown OutputHandling Merged CellsReal-World ExamplesFinancial ReportsAcademic PapersBusiness DocumentsBest PracticesImage QualityComplex TablesPost-ProcessingPerformance ComparisonTroubleshootingCommon IssuesConclusionRelated Articles

More Posts

Structured Information Extraction: GLM-OCR JSON Output for Documents
FeatureTutorial

Structured Information Extraction: GLM-OCR JSON Output for Documents

Learn how to use GLM-OCR for structured information extraction from invoices, ID cards, receipts, and forms with customizable JSON schema output.

avatar for GLM-OCR Team
GLM-OCR Team
2025/01/11
GLM-OCR: 0.9B Parameters Achieving OCR SOTA Performance
News

GLM-OCR: 0.9B Parameters Achieving OCR SOTA Performance

Introducing GLM-OCR, a lightweight professional OCR model with only 0.9B parameters that achieves state-of-the-art performance on OmniDocBench V1.5 with a score of 94.62.

avatar for GLM-OCR Team
GLM-OCR Team
2025/01/15
GLM-OCR Local Deployment: Ollama vs vLLM vs SGLang
DeploymentTutorial

GLM-OCR Local Deployment: Ollama vs vLLM vs SGLang

Compare different local deployment options for GLM-OCR including Ollama, vLLM, and SGLang. Learn which option is best for your use case.

avatar for GLM-OCR Team
GLM-OCR Team
2025/01/10
LogoGLM-OCR

Lightweight Professional OCR Model with State-of-the-Art Performance

GitHubGitHubTwitterX (Twitter)DiscordEmail
Product
  • Features
  • Pricing
  • FAQ
Resources
  • Blog
Links
  • Hugging Face
  • GitHub
  • Ollama
Legal
  • Cookie Policy
  • Privacy Policy
  • Terms of Service
© 2026 GLM-OCR All Rights Reserved.
MossAI ToolsAiTop10 Tools DirectoryZ-ImageSubmit AI Tools – The ultimate platform to discover, submit, and explore the best AI tools across various categories.Featured on ShowMeBestAIFeatured on Wired BusinessShowMySitesFeatured on Twelve ToolsListed on Turbo0Featured on findly.toolsFazier badgePower Up ToolsFeatured on DeepLaunch.ioGLM-OCR Free Online OCR Tool - Featured AI Agent on AI Agents DirectoryFeatured on newtool.siteListed on BuildWayMossAI ToolsAiTop10 Tools DirectoryZ-ImageSubmit AI Tools – The ultimate platform to discover, submit, and explore the best AI tools across various categories.Featured on ShowMeBestAIFeatured on Wired BusinessShowMySitesFeatured on Twelve ToolsListed on Turbo0Featured on findly.toolsFazier badgePower Up ToolsFeatured on DeepLaunch.ioGLM-OCR Free Online OCR Tool - Featured AI Agent on AI Agents DirectoryFeatured on newtool.siteListed on BuildWay