Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files from any .NET platform (C#, VB.NET, ASP.NET, .NET Core) and Java applications (J2SE and J2EE) with fast and high quality performance.

Fri Nov 18, 2011 5:41 am

Hi,

Scenario: I'm pulling in large strings and conditionally exporting them to a pdf document. I've tested up to 600 character strings that this is working fine using the "replace" function. I want to output these strings formatted with new line's so I use this value in the text "Environment.Newline".

Issue: Even when I use strings of 400 characters with the newline value the document can't be saved as the index is out of range. However, if I reduce the amount to say 50 characters it works fine.

i.e No newline newline

Long String Works Doesn't work

Short String Works Works

Please let me know if you need any additional information.

djwinder
 
Posts: 4
Joined: Tue Nov 15, 2011 4:58 am

Fri Nov 18, 2011 3:45 pm

Hello djwinder,

Sorry for the inconvenience caused by us and thank you for your patience.

Would you sent the file/code to help us reproduce the problem?

Thanks in advance.
Have a nice day.
Tina
Technical Support/Developer,
e-iceblue Support Team
User avatar

Tina.Lin
 
Posts: 152
Joined: Tue Sep 13, 2011 5:37 am

Sat Nov 19, 2011 6:46 am

Hello djwinder,


Sorry for that I am not very clear about the meaning of your issue.

Do you mean that:
1.Get a string from doc file
2.use the "replace" function to replace some words of the string
3.Get the string formatted byEnvironment.newline then save the string to pdf

Have a nice day.
Tina
Technical Support/Developer,
e-iceblue Support Team
User avatar

Tina.Lin
 
Posts: 152
Joined: Tue Sep 13, 2011 5:37 am

Sat Nov 19, 2011 7:38 am

Hello

I attached the demo. You can have a try.
If you still have any other questions, please feel free to contact us.
You do not have the required permissions to view the files attached to this post.
Tina
Technical Support/Developer,
e-iceblue Support Team
User avatar

Tina.Lin
 
Posts: 152
Joined: Tue Sep 13, 2011 5:37 am

Sun Nov 20, 2011 9:48 pm

Hi Tina,

Here's the source code of what I'm talking about. If you reduce the size of the string it shows up fine. Also, if you take out the pipes (new lines) it shows up fine.

using System;
using System.Windows.Forms;
using Spire.Doc;

namespace Replace
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
//Create word document
Document document = new Document();

//load a document
document.LoadFromFile(@"..\\..\\test.docx",FileFormat.Docx2010);

// Test string
string testS = "testing|testing|testing|testing|testing|testing|testing|testing|testing|testing|testing|testing|testing|testing|testing|testing|testing|testing|testing|testing|testing|testing|testing|testing|testing|testing|testing|testing|testing|testing|testing|testing|testing|testing|testing|testing|testing|testing|testing|testing|testing|testing|testing|testing|testing|testing|testing|testing|testing|testing|testing|testing|testing|testing|testing|";
int len = testS.Length;
string testFormatted = testS.Replace("|", Environment.NewLine);

//Replace text
//document.Replace(this.textBox1.Text, this.textBox2.Text+Environment.NewLine + "test"+Environment.NewLine+"Test2",true,true);
document.Replace("TEST", testFormatted, true, true);
//Save doc file.
document.SaveToFile("Sample.pdf", FileFormat.PDF);

//Launching the MS Word file.
WordDocViewer("Sample.pdf");
}

private void WordDocViewer(string fileName)
{
try
{
System.Diagnostics.Process.Start(fileName);
}
catch { }
}
}
}

djwinder
 
Posts: 4
Joined: Tue Nov 15, 2011 4:58 am

Sun Nov 20, 2011 10:03 pm

Whoops, just overlooking the code that I sent you, there is about another 2 lines of testing with pipes :)

djwinder
 
Posts: 4
Joined: Tue Nov 15, 2011 4:58 am

Mon Nov 21, 2011 7:38 am

Hello djwinder,

Sorry for the inconvenience caused by us and thank you for your patience.

We have reproduced the problem. We need some time to fix on this issue. Would you kindly give us more time?
Once we finished, we will inform you as soon as possible.

Thanks
Have a nice day.
Tina
Technical Support/Developer,
e-iceblue Support Team
User avatar

Tina.Lin
 
Posts: 152
Joined: Tue Sep 13, 2011 5:37 am

Mon Nov 21, 2011 11:29 pm

Hi Tina,

I don't mean to bug, were you able to reproduce the issue?

djwinder
 
Posts: 4
Joined: Tue Nov 15, 2011 4:58 am

Tue Nov 22, 2011 6:53 am

Hello djwinder,

I have reproduced the problem. The PDF file generated by Spire.Doc is a blank file as your. Maybe in parsing files came up with error. We still need time to research on this issue. Please wait with patience. Once we have progress in the issue , we will inform you as soon as possible.

Have a nice day.
Tina
Technical Support/Developer,
e-iceblue Support Team
User avatar

Tina.Lin
 
Posts: 152
Joined: Tue Sep 13, 2011 5:37 am

Wed Nov 30, 2011 8:39 am

Hello djwinder,

Sorry for late reply.

The problem you proposed last week had been fixed in Spire.Doc HotFix 4.1.14. You can download it from the following address:
http://www.e-iceblue.com/Download/download-word-for-net-now.html.

If you still have any other questions, please don't hesitate to contact us.

Hava a nice day.
Tina
Technical Support/Developer,
e-iceblue Support Team
User avatar

Tina.Lin
 
Posts: 152
Joined: Tue Sep 13, 2011 5:37 am

Wed Mar 20, 2019 9:55 am

bulk text replace function is taking lots of time to replace text .

anuja_cs
 
Posts: 1
Joined: Wed Feb 27, 2019 7:30 am

Wed Mar 20, 2019 10:18 am

Hi,

Thank you for contacting us.
If you were using an old version, I would suggest that you try the latest Spire.PDF Pack(Hot Fix) Version:5.3.8, if the long time issue still exists, please provide your testing code as well as the input PDF file you used, also tell us how long it took on your side. You could send resource to us via email (support@e-iceblue.com). Then we can look into your case accurately and help you accordingly.

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 965
Joined: Tue Sep 27, 2016 1:06 am

Tue Apr 09, 2019 11:31 am

Hi,

Greetings from E-iceblue!
How is your issue going? Could you please give us some feedback at your convenience?
Thanks in advance.

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 965
Joined: Tue Sep 27, 2016 1:06 am

Return to Spire.Doc