Open Text file as Fixed Width file format

Hi,

I would like to open a flat file with ASPOSE.Cells. The flat file is Space delimited format.

Please can someone help me with my query. I could see there is an option for tab delimited file but nothing for Space delimited.

I have already used the following vb.net code:

Dim SpaceDelimiter As Char = " "

workbook.Open(docsDir & filenamewthExtn, SpaceDelimiter)

But with no luck please can you suggest another method.

Thank you for your time.

Best regards,

Mo


This message was posted using Aspose.Live 2 Forum

Hi,

Could you post your sample txt(space delimited) file here, we will check it soon.
By the way, did you find any error and what is the description of the error?
Also, did you try:
Dim SpaceDelimiter As Char = " "c
Dim workbook As New Workbook()
workbook.Open(“F:\test\testspacefile.txt”, SpaceDelimiter)


Thank you.

Hi Amjad,

Thank you very much for your instant reply really apperciate it.

I tried the code above, but with no luck. I have attached a my sample file.

Please let me know if you require any further information.

Thanks

Best regards,

Mohammed

Hi,

Thanks for providing us the template file.

I think you may try to use Tab Delimited file format if it suits your need.
e.g

Dim workbook As New Workbook()
workbook.Open(“F:\test\TOF129.txt”, FileFormatType.TabDelimited)




Thank you.

Hi Amjad,

I have used the tab delimited format aswell but it does not work.

Is there another solution?

If you open the Text file in Excel it works only when you select Space Delimited.

Really apperciate all your help.

Thanks

Best regards,

Mohammed

Hi,

Thank you for considering Aspose.

We have registered your request for “Fixed Width Delimated” format. We will look into your required feature and get back to you soon. Your Request has been register in our issue tracking system with issue id CELLSNET-11732.

Thank You & Best Regards,

Hi,

Please try the fix (attached), it should work fine now for your need. We have tested with the following code:

Workbook workbook = new Workbook();
workbook.Open(“F:\test\TOF129.txt”, ’ ');


Thank you.

Hi Amjad,

Thank you again for all your help, I really apperciate the time and effort you are putting in for me.

I have copied the files into the following directory:

C:\Program Files\Aspose\Aspose.Cells\Bin\Net2.0

Then i tried the following code below:

Workbook workbook = new Workbook();
workbook.Open("F:\test\TOF129.txt", ' ');

It comes with an error after , ' ');

Im using VB.NET I dont know if this code is for C#.

Shall i also update the files with the C:\Program Files\Aspose\Aspose.Cells\Bin\Net1.0?

Please let me know what i should do.

Thanks

Mohammed

Hi Amjad,

I have also updated the Bin Reference files to point to the new updated dll file in my website project.

Thanks

Mohammed

Hi,

Please delete older reference(s) to Aspose.Cells.dll file in your project and use only to newer Aspose.Cells.dll v4.8.0.16 file in your project reference.

Here is the sample vb.net code that you may use:

Dim SpaceDelimiter As Char = " "c
Dim workbook As New Workbook()
workbook.Open(“F:\test\OF129.txt”, SpaceDelimiter)


Thank you.

Hi Amjad,

Thanks a million i figured it out. I used the code you send me earlier on.

Dim SpaceDelimiter As Char = " "c

Dim workbook1 As New Workbook()

workbook1.Open(docsDir & filenamewthExtn, SpaceDelimiter)

This works fine thanks.

Best regards,

Mohammed