|
If it is a HTML page then \n need to be replaced with <BR> tag. Isn't it?
|
|
|
|
|
I dont know, but that could be correct (unless inside a PRE block).
|
|
|
|
|
Hi,
One of my clients has exported his product list to CSV, and there are funny characters in the long description, and it is giving me errors when I try doing an import. The long description cell has little white blocks at the end of the text, almost like a new line. How would I test for something like this, and remove it?
What is it?
Regards
ma se
|
|
|
|
|
Is it unicode by some chance?
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
|
|
|
|
|
Hi,
I worked on a project which writes 2 doc files, in memory stream.
From the memory stream I wrote all the bytes to a file
something like this:
File.WriteAllBytes(path,mybytes).
The problem is that I can't see all the information.
But if I look in my file with Windows Commander the information which I can't see is there.
Where should be the problem?
Thanks for your help.
|
|
|
|
|
WhiteGirl23 wrote: The problem is that I can't see all the information.
"See all the information"? You've gone bind and now can't use a monitor? Your trying to use photoshop to open the doc file but the pixels arn't in the right place? Your highly advanced brain interface isn't causing the right electrical impulses in the visual processing part of your brain?
You might want to explain yourself in explicit developer terms rather than clueless user terms. i.e. "I try to look at the value in the watch panel in visual studio" or "if I then open the file in notepad I can't see the byte's I have written".
The problem could be that whatever your using to look at the data isn't interpreting it correctly or that the data is being written incorrectly. It's pretty hard to tell without being psychic or being given some pretty basic information.
|
|
|
|
|
my code is:
//write in memory the files
MemoryStream mem = new MemoryStream();<br />
BinaryWriter bin = new BinaryWriter(mem);<br />
bin.Write(unicodebytes, 0, number);<br />
<br />
<br />
bin.Write(unicodebytes1, 0, number1);
//unicodebytes,unicodebytes1 are vectors where I keep the bytes from the files
//read the files
BinaryReader binread = new BinaryReader(mem);<br />
mem.Position = 0;<br />
<br />
<br />
byte[] byteArray = new byte[mem.Length];<br />
int count;<br />
count = mem.Read(byteArray, 0,1);<br />
while (count < mem.Length)<br />
{<br />
byteArray[count++] = Convert.ToByte(mem.ReadByte());<br />
<br />
File.WriteAllBytes("C:\\text1.doc", byteArray);<br />
My problem is that I can see the first file in Word but I can't see the second file.
|
|
|
|
|
flush the BinaryWriter before re-reading the data.
<br />
MemoryStream mem = new MemoryStream();<br />
BinaryWriter bin = new BinaryWriter(mem);<br />
bin.Write(unicodebytes, 0, number);<br />
<br />
<br />
bin.Write(unicodebytes1, 0, number1);<br />
<br />
bin.Flush();
<br />
-----
If atheism is a religion, then not collecting stamps is a hobby. -- Unknown
|
|
|
|
|
thank for your help but still doesn't work
|
|
|
|
|
try to explain the context : what are you trying to achieve ?
is it binary data ? text ? in ASCII ? in Unicode ?
are they both Word documents ?
where does the data originate ? show the declarations !
and specify the symptoms in detail: what does "can see" mean ?
is the first file OK, or just recognizable ?
and what about the second: nothing at all, some garbage,
some parts recognizable, what ?
if you are not explicit about these, you either will get no answers, or some
answer that is as mysterious as your questions are...
|
|
|
|
|
the first file is seen very good.
My files are document files.
But the second file is missing.
I turned my documents files in bytes and these files are written to the memory stream.
From the memory stream (where I have the 2 documents in bytes)I want to see the 2 files in one file.
Thanks.
|
|
|
|
|
Now who claims that appending two document files would result in one document file
with all the document content ?
You can use a hex dump utility (Visual Studio !), or maybe Wordpad, to check
your concatenation succeeded technically, Word has already proven it did not
succeed functionaly.
You can concatenate two text files, two C# source files (that will result in some
compile errors tho), maybe two mp3 files. But you cant get the result you're after
when you concatenate two JPEG files, two Visual Studio project files,
two MS Word files, etc.
You need something smarter and more difficult to achieve that.
|
|
|
|
|
There are a couple of things strange in your code.
1- You assign a BinaryReader but you do not use it.
2- You are writing a bunch of bytes to a MemoryStream. Are you just trying to copy the 2 byte arrays to a single file (if not, what your code is doing totally escapes me)? This is not really needed. Try this instead:
FileStream fs = File.Create(@"C:\text.doc");
fs.Write(unicodebytes, 0, unicodebytes.Length);
fs.Write(unicodebytes1, 0, unicodebytes1.Length);
fs.Flush();
fs.Close();
If this is not the case, please explain what you are trying to do.
-----
If atheism is a religion, then not collecting stamps is a hobby. -- Unknown
|
|
|
|
|
thanks for your help but I have the same problem.
I can see the first file but I can't see the second.
I want to copy 2 documents files in one file.
|
|
|
|
|
Did you try to run it through a debugger? is it possible that unicodebytes1 is empty?
Make sure your 2 byte arrays actually contain the bytes.
-----
If atheism is a religion, then not collecting stamps is a hobby. -- Unknown
|
|
|
|
|
thanks for your help.
The size of my new created file is equal with the size of the first file + the size of the second file.
The unicodebytes1 is not null.
thanks again.
|
|
|
|
|
Combining 2 word documents by appending one to the other will never work. Your barking up the wrong tree.
|
|
|
|
|
If your trying to combine 2 wrod doc's it's not that simple.
Word docs use Structured Storage[^] (aka DocFile[^]) for pre 2007 files.
For 2007 there is a new XML format ... you can do your own google for that :P
Either way you cannot simply concatenate these documents.
|
|
|
|
|
thanks for all your help.
I found how to resolve my problem(with tx textcontrol).
Thanks again.
Regards,
WhiteGirl23
|
|
|
|
|
I have a list box with some items.
my code snippet:
foreach(string item in listbox1.items)
{
// some code
}
it gaives an exception:
Unable to cast object of type 'System.Drawing.Point' to type 'System.String'.
which is in the first line i.e string item
help me with an alternative way
|
|
|
|
|
listbox1.items returns a ListItemCollection (you must use System.Collections), it doesn't return a string array.
foreach(ListItem item in listbox1.items)
{
string sText = item.Text;
string sValue = item.Value;
// some code
}
Regards.
Just call me Valy...
|
|
|
|
|
Thanks for the suggestion...
But when I use
foreach(ListItem item in listbox1.items)
{
}
It throws an exception saying ListItem is not a type or namespace
are u missing a assembly reference or an using directive
|
|
|
|
|
sangramkp wrote: are u missing a assembly reference or an using directive
Well, Are you?
ListItem is in the System.Web.UI.WebControls namespace. It is probably the 'using' you are missing rather than the assembly reference.
|
|
|
|
|
But I am working on windows Application...
|
|
|
|
|
But i am working on a windows forms application
|
|
|
|