devZenaight commited on
Commit
09421ea
·
1 Parent(s): 53b16c0
app/DocumentGeneration/word_generator.py CHANGED
@@ -232,41 +232,11 @@ def create_word_document(request: ExportRequest):
232
  # Add page break before each section (including Executive Summary)
233
  doc.add_page_break()
234
 
235
- # Add section heading
236
- doc.add_heading(section.title, level=1)
237
 
238
- # Clean and process content WITH inline charts
239
- try:
240
- clean_content = clean_text_for_pdf(section.content)
241
- except Exception:
242
- clean_content = section.content or ""
243
- try:
244
- clean_content = convert_currency_symbols_to_iso(clean_content)
245
- except Exception:
246
- pass
247
-
248
- # Remove the section title from content to prevent duplication
249
- section_title_clean = section.title.strip()
250
- content_lines = clean_content.split('\n')
251
- filtered_lines = []
252
- for line in content_lines:
253
- line_clean = line.strip()
254
- # Skip lines that match the section title (with or without markdown)
255
- # Check for various markdown formats and variations
256
- if (line_clean == section_title_clean or
257
- line_clean == f"**{section_title_clean}**" or
258
- line_clean == f"# {section_title_clean}" or
259
- line_clean == f"## {section_title_clean}" or
260
- line_clean == f"### {section_title_clean}" or
261
- line_clean == f"#### {section_title_clean}" or
262
- # Also check if the line starts with the section title (for numbered headings)
263
- line_clean.startswith(f"{section_title_clean}") and len(line_clean) <= len(section_title_clean) + 10):
264
- continue
265
- filtered_lines.append(line)
266
- clean_content = '\n'.join(filtered_lines)
267
-
268
- # Process content with inline charts - THIS IS THE KEY CHANGE
269
- process_content_with_inline_charts(doc, clean_content, request.businessIdea or "Business")
270
 
271
  doc.add_paragraph()
272
 
 
232
  # Add page break before each section (including Executive Summary)
233
  doc.add_page_break()
234
 
235
+ # Don't add section heading here - it's already in the TOC
236
+ # The section title is already displayed in the Table of Contents
237
 
238
+ # Process content with inline charts - use ORIGINAL content to preserve chart markers
239
+ process_content_with_inline_charts(doc, section.content, request.businessIdea or "Business")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
240
 
241
  doc.add_paragraph()
242