Jumer Ronulo

Jumer Ronulo

  • NA
  • 4
  • 6.1k

Inserting Citation and with the corresponding Bibliography i

Jan 14 2014 2:09 PM
Hi,

Does anyone know how to insert a citation with the corresponding bibliography at the buttom of the document in c#?
what I mean is that
 
 
when I insert a citation it will look like this
(Citation1)blablabla
Bibliography1
if I insert again a citation it will look like this
(Citation1)blablabla(Citation2)
Bibliography1
Bibliography2
 
 
I found some software that do exactly to what i want and i wonder how did they make it
here's the link : http://www.youtube.com/watch?v=HSNK1YUA7hU[^]

I've a program about this but I have a problem about it 
 here's my code
 
private void InsertCitation_Click(object sender, RibbonControlEventArgs e)
{
// Insert a citation after the text just inserted to the bibliography
// source added previously.
Application wordApplication = Globals.ThisAddIn.Application;
//wordApplication.Selection.EndKey(ref paramWdUnits,ref paramWdMovementType);
wordApplication.Selection.Fields.Add(wordApplication.Selection.Range,
ref paramWdFieldTypeCitation, dropDown1.SelectedItem.Label,//ref paramBiblioSourceTag,
ref paramMissing);
// wordApplication.Selection.Fields.Add(wordApplication.Selection.Range,
// ref paramWdFieldTypeCitation,
// ref paramBiblioSourceTag,ref paramMissing);
// Insert a page break after the citation added previously and then
// add a bibliography to the document.
Word.Document doc = Globals.ThisAddIn.Application.ActiveDocument;
Word.Range rng = doc.Content;
object oCollapseEnd = Word.WdCollapseDirection.wdCollapseEnd;
rng.Collapse(ref oCollapseEnd);
wordApplication.Selection.EndKey(ref paramWdUnits, ref paramWdMovementType);
wordApplication.Selection.InsertBreak(WdBreakType.wdLineBreak);
//If find the Bibliography field in the document then update the field
//otherwise insert a Bibliography field
bool isFoundFieldBibliography = false;
foreach (Field field in wordApplication.ActiveDocument.Range().Fields)
{
if (field.Type == WdFieldType.wdFieldBibliography)
{
isFoundFieldBibliography = true;
//update BibliographyField
field.Update();
}
}
if (!isFoundFieldBibliography)
{
wordApplication.Selection.Fields.Add(wordApplication.Selection.Range,
ref paramWdFieldTypeBiblio, ref paramMissing, ref paramMissing);
}
}private void RefreshBibliography_Click(object sender, RibbonControlEventArgs e)
{
Refresh_Bibliography();
}
private void Refresh_Bibliography()
{
this.dropDown1.Items.Clear();
foreach (Source source in Globals.ThisAddIn.Application.ActiveDocument.Bibliography.Sources)
{
RibbonDropDownItem item = Globals.Factory.GetRibbonFactory().CreateRibbonDropDownItem();
item.Label = source.Tag;
this.dropDown1.Items.Add(item);
}
}
 
 

I hope someone can help me on how to achieve this
Thank you in advance
more power
god bless

please I really need help